I’m trying to update our application from Drools 4.0.7 to Drools 5.5 (or 5.3 if that’s better).
All the rules compile and I am serializing the KnowledgeBase and reading it in upon application start-up.
Inserting facts works find. Retracting can often return the NullPointerException shown below. That clip comes from a unit test that literally just inserts 10 “TestFact” objects and then tries to retract them one at a time. No rule firing
happens, just insertion and retraction. I did try adding a rule firing in between the insert and retraction loops but it made no difference. These “TestFact” object don’t actually trigger any rules if that matters.
I’ve tried this with both the Drools 5.5.0.Final and 5.3.0.Final jars with the same results. Searches on the forum and on Google show this as a bug in 5.5.0.Final, but say it should work in 5.3.0.Final. It doesn’t work on either for me.
I am going to try some variations on this test, but it seems like this should work as-is.
Any suggestions would be greatly appreciated.
2013-10-14 11:56:02,533 (ERROR) [AgdKnowledgeSession] caught exception trying to retract TestFact [name=testfact-0]
java.lang.NullPointerException
at org.drools.core.util.RightTupleIndexHashTable.remove(RightTupleIndexHashTable.java:365)
at org.drools.reteoo.NotNode.retractRightTuple(NotNode.java:172)
at org.drools.reteoo.ObjectTypeNode.retractObject(ObjectTypeNode.java:257)
at org.drools.reteoo.EntryPointNode.retractObject(EntryPointNode.java:330)
at org.drools.common.NamedEntryPoint.retract(NamedEntryPoint.java:542)
at org.drools.common.NamedEntryPoint.retract(NamedEntryPoint.java:486)
at com.teradata.agd.AgdKnowledgeSession.retract(AgdKnowledgeSession.java:134)
at com.teradata.agd.AgCoreManager.executeFactEvent(AgCoreManager.java:279)
at com.teradata.agd.AgCoreManager.executeRuleEngine(AgCoreManager.java:189)
at com.teradata.agd.AgCoreManager.enqueue(AgCoreManager.java:259)
at com.teradata.agd.AgCoreManager.retractFact(AgCoreManager.java:480)
at com.teradata.agdtest.functional.FactInsertionAndRetractionTest.testFactInsertion(FactInsertionAndRetractionTest.java:50)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:84)
at org.testng.internal.Invoker.invokeMethod(Invoker.java:714)
at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:901)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1231)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:127)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:111)
at org.testng.TestRunner.privateRun(TestRunner.java:767)
at org.testng.TestRunner.run(TestRunner.java:617)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:335)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:330)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:291)
at org.testng.SuiteRunner.run(SuiteRunner.java:240)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1224)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1149)
at org.testng.TestNG.run(TestNG.java:1057)
at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:111)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:204)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:175)