apache livy said NullPointerException when i input the List

I am using apache livy and try this code for running it.


public class App {

public static void main(String[] args)

throws IOException, URISyntaxException, InterruptedException, ExecutionException {

String livyUrl = "http://MY_LIVY_SERVER:8998";

String jar = "target\\livy_test-0.0.1-SNAPSHOT.jar";

LivyClient client = new LivyClientBuilder().setURI(new URI(livyUrl)).build();

try {

client.uploadJar(new File(jar)).get();

List data = Arrays.asList(1,2,3,4,5,6,7,8,1,2);

int result = client.submit(new Counter(data)).get();

System.out.println("result of Counter: " + result);

} finally {






public class Counter implements Job {

List data;

Counter(List data) {

this.data = data;


public Integer call(JobContext arg0) throws Exception {

// TODO Auto-generated method stub

JavaSparkContext jsc = arg0.sc();

JavaRDD rdd = jsc.parallelize(data);

return (int) rdd.count();



and i got this error

Exception in thread "main" java.util.concurrent.ExecutionException: java.lang.RuntimeException: org.apache.livy.shaded.kryo.kryo.KryoException: java.lang.NullPointerException


Read More »

By: StackOverFlow - Wednesday, 7 November

Related Posts