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:
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?