flink1.7.2 drools7.23.0 集群模式运行异常

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

flink1.7.2 drools7.23.0 集群模式运行异常

王峰
    您好,我在做flink1.7.2 集成 drools7.23.0测试时发现任务在本地运行正常,打包提交的flink集群上运行时出现drools空指针异常。代码如下:
input.map(new RichMapFunction<Person , Person>() {
@Override
public Person map(Person s) throws Exception { KieHelper kieHelper = new KieHelper();

kieHelper.kfs.write( new ClassPathResource( "rules/Sample.drl") );
KieBase kbase = kieHelper.build();
StatelessKieSession statelessKieSession = kbase.newStatelessKieSession();
statelessKieSession.execute(s);
return s;
}
})


错误日志:
java.lang.NullPointerException
        at org.kie.internal.io.ResourceFactory.newByteArrayResource(ResourceFactory.java:66)
        at org.drools.compiler.kie.builder.impl.AbstractKieModule.getResource(AbstractKieModule.java:310)
        at org.drools.compiler.kie.builder.impl.AbstractKieModule.addResourceToCompiler(AbstractKieModule.java:273)
        at org.drools.compiler.kie.builder.impl.AbstractKieModule.addResourceToCompiler(AbstractKieModule.java:268)
        at org.drools.compiler.kie.builder.impl.AbstractKieProject.buildKnowledgePackages(AbstractKieProject.java:257)
        at org.drools.compiler.kie.builder.impl.AbstractKieProject.verify(AbstractKieProject.java:75)
        at org.drools.compiler.kie.builder.impl.KieBuilderImpl.buildKieProject(KieBuilderImpl.java:270)
        at org.drools.compiler.kie.builder.impl.KieBuilderImpl.buildAll(KieBuilderImpl.java:238)
        at org.drools.compiler.kie.builder.impl.KieBuilderImpl.buildAll(KieBuilderImpl.java:187)
        at org.kie.internal.utils.KieHelper.getKieContainer(KieHelper.java:84)
        at org.kie.internal.utils.KieHelper.build(KieHelper.java:71)
        at com.wf.flink.cep.FlinkDrools$1.map(FlinkDrools.java:56)
        at com.wf.flink.cep.FlinkDrools$1.map(FlinkDrools.java:27)
相同代码将drools 包更换为6.5,本地与集群执行都正常。查看了6.5,7.23报错的类实现方式改变了,不知为何用使用drools7.23跑在集群上就出错?
非常期待您的回复,谢谢