[Livy]Unable to add jars when creating a session

426 views
Skip to first unread message

John Xu

unread,
Jan 14, 2016, 2:54:23 AM1/14/16
to Hue-Users
Hi,
I wrote a piece of program, and I imported some packages from an external jar file.
I'm now trying to create a session using java HttpClient, and I write codes as follow:

    jsonParam.put("kind", "spark");
    jsonParam.put("jars", new JSONArray("[\"/opt/spark/lib/udf.jar\"]");
    StringEntity entity = new StringEntity(jsonParam.toString());
    entity.setContentType("application/json");
    httpPost.setEntity(entity);
    httpclient.execute(httpPost);

When I submit my program, an error shows that packages cannot be found:

<console>:21: error: not found: value udfpac
       import udfpac.MyUDF

But it works well when I run spark-shell with command "spark-shell --jars /opt/spark/lib/udf.jar". So I guess that I failed to add the jar when creating the session through Livy. Could anyone help me with this?

Thanks. 


Shubham Vadhera

unread,
Jul 14, 2016, 7:53:14 PM7/14/16
to Hue-Users
Place the JAR file in following livy directory:

/home/user/livy/repl/target/jars

Reply all
Reply to author
Forward
0 new messages