我正在尝试在提交到集群的火花作业中使用流口水。这项工作将从drools 服务器获取drools jar 开始,然后初始化基础和会话。我的代码在 Spark 中执行时可以工作,但在提交到 Spark 集群时会发生 NPE。
这就是我正在做的
String url = "{my server address}/drools-wb/maven2/com/myspace/Project1/1.0.0/Project1-1.0.0.jar";
KieServices ks = KieServices.Factory.get();
//ERROR is in the below line
ReleaseId releaseId = ks.newReleaseId("com.myspace", "Project1", "1.0.0");
KieRepository kr = ks.getRepository();
UrlResource urlResource = (UrlResource) ks.getResources().newUrlResource(url);
提交代码后出现的错误:
Exception in thread "main" java.lang.NullPointerException
at org.opencell.spark.jobs.TestWithDrools.main(TestWithDrools.java:47)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.spark.deploy.JavaMainApplication.start(SparkApplication.scala:52)
at org.apache.spark.deploy.SparkSubmit$.org$apache$spark$deploy$SparkSubmit$$runMain(SparkSubmit.scala:879)
at org.apache.spark.deploy.SparkSubmit$.doRunMain$1(SparkSubmit.scala:197)
at org.apache.spark.deploy.SparkSubmit$.submit(SparkSubmit.scala:227)
at org.apache.spark.deploy.SparkSubmit$.main(SparkSubmit.scala:136)
at org.apache.spark.deploy.SparkSubmit.main(SparkSubmit.scala)
2018-08-29 10:08:09 INFO ShutdownHookManager:54 - Shutdown hook called
你有解决这个问题的想法吗?