You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@zeppelin.apache.org by moon soo Lee <mo...@apache.org> on 2015/10/11 15:02:43 UTC

Re: Error running Junit in zeppelin-spark module

setupListeners() changed by
https://github.com/apache/incubator-zeppelin/pull/294.  I think it fixes
the error. You can try the code after commits from PR-294.

Thanks,
moon

On Fri, Sep 18, 2015 at 9:29 PM Dimp Bhat <di...@gmail.com> wrote:

> Hi,
> I'm running the Junits in the zeppelin-spark module. When I run the
> SparkInterpreterTest or SparkSqlInterpreterTest, the Junit succeeds but I
> see this error on the console:
> java.lang.NoSuchMethodException:
>
> org.apache.spark.scheduler.LiveListenerBus.addListener(org.apache.spark.scheduler.SparkListener)
> at java.lang.Class.getMethod(Class.java:1678)
> at
>
> org.apache.zeppelin.spark.SparkInterpreter.setupListeners(SparkInterpreter.java:163)
> at
>
> org.apache.zeppelin.spark.SparkInterpreter.getSparkContext(SparkInterpreter.java:150)
> at
> org.apache.zeppelin.spark.SparkInterpreter.open(SparkInterpreter.java:432)
> at
>
> org.apache.zeppelin.spark.SparkSqlInterpreterTest.setUp(SparkSqlInterpreterTest.java:52)
>
> If you look at the setupListeners() below, it is trying to invoke the
> method "addListener" from the org.apache.spark.scheduler.SparkListener
> class but when I look at the Spark 1.4.1 API, the addListener() is in
> org.apache.spark.util.ListenerBus
> <
> http://spark.apache.org/docs/1.3.0/api/java/org/apache/spark/util/ListenerBus.html
> >
> so looks like a bug to me? Pls. advise.  Thanks.
>
> Dimple
> ===========================
>
> p*rivate static JobProgressListener setupListeners(SparkContext context) {*
> *    JobProgressListener pl = new JobProgressListener(context.getConf());*
> *    try {*
> *      Object listenerBus =
> context.getClass().getMethod("listenerBus").invoke(context);*
> *      Method m = listenerBus.getClass().getMethod("addListener",
> SparkListener.class);*
> *      m.invoke(listenerBus, pl);*
> *    } catch (NoSuchMethodException | SecurityException |
> IllegalAccessException*
> *        | IllegalArgumentException | InvocationTargetException e) {*
> *      e.printStackTrace();*
> *    }*
> *    return pl;*
> *  }*
>
> *=================================*
>