我正在使用 drools 专家 6.0.0.Beta3(下载页面上提供的最新版本),并且我正在尝试更新工作内存中存在的规则。基本上,我再次调用 kBuilder 的 add() ,如下所示:
kBuilder.add(org.drools.io.ResourceFactory.newByteArrayResource(drl.getBytes()),
org.drools.builder.ResourceType.DRL);
当我第一次添加规则时,它会被添加,甚至在条件满足时触发。但是,当再次调用 add() 时,如上所述,我得到以下异常:
java.lang.NullPointerException
at org.drools.compiler.compiler.PackageBuilder.validateUniqueRuleNames(PackageBuilder.java:1314)
at org.drools.compiler.compiler.PackageBuilder.initPackageRegistry(PackageBuilder.java:916)
at org.drools.compiler.compiler.PackageBuilder.addPackage(PackageBuilder.java:869)
at org.drools.compiler.compiler.PackageBuilder.addPackageFromDrl(PackageBuilder.java:474)
at org.drools.compiler.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:670)
at org.drools.compiler.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:51)
at org.drools.compiler.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:40)
at org.drools.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:34)
...