[rules-users] error on retracting fact on drools 5.0.1

Garner, Shawn Garner.Shawn at principal.com
Thu Jan 21 18:38:59 EST 2010


I have a rule and it is supposed to retract two objects

when

    $objectOne : ObjectOne(...)
    $objectTwo : ObjectTwo(...)

then

	retract($objectOne);
	#retract($objectTwo); 

end

No matter what I do I can't ever retract objectTwo.

I put a print statement and it is there.

If I comment out the retraction of objectTwo it works fine.
I tried just retraction of objectTwo and that fails too.
I tried prefixing with drools.retract.

I get this:

com.principal.health.rules.RulesException: Root exception: [Error: drools.retract($objectTwo): null]
[Near : {... Unknown ....}]
             ^
[Line: 1, Column: 0] - [Error: drools.retract($objectTwo): null]
[Near : {... Unknown ....}]
             ^
[Line: 1, Column: 0]
	at com.principal.health.rules.impl.DroolsRuleSetImpl.fireRuleflow(DroolsRuleSetImpl.java:100)
	at com.principal.health.rules.RulesTestCase.executeRules(RulesTestCase.java:247)
	at com.principal.health.rules.RulesTestCase.executeAvailableRules(RulesTestCase.java:129)
	at com.principal.health.rules.impl.available.MemberNetworkXFormRulesRuleId6Test.retractMemberNetworkContractWithNullTeminationDates(MemberNetworkXFormRulesRuleId6Test.java:235)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:79)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:618)
	at org.junit.internal.runners.TestMethodRunner.executeMethodBody(TestMethodRunner.java:99)
	at org.junit.internal.runners.TestMethodRunner.runUnprotected(TestMethodRunner.java:81)
	at org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:34)
	at org.junit.internal.runners.TestMethodRunner.runMethod(TestMethodRunner.java:75)
	at org.junit.internal.runners.TestMethodRunner.run(TestMethodRunner.java:45)
	at org.junit.internal.runners.TestClassMethodsRunner.invokeTestMethod(TestClassMethodsRunner.java:71)
	at org.junit.internal.runners.TestClassMethodsRunner.run(TestClassMethodsRunner.java:35)
	at org.junit.internal.runners.TestClassRunner$1.runUnprotected(TestClassRunner.java:42)
	at org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:34)
	at org.junit.internal.runners.TestClassRunner.run(TestClassRunner.java:52)
	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:38)
	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
Caused by: org.drools.runtime.rule.ConsequenceException: [Error: drools.retract($wrappedNetwork): null]
[Near : {... Unknown ....}]
             ^
[Line: 1, Column: 0]
	at org.drools.runtime.rule.impl.DefaultConsequenceExceptionHandler.handleException(DefaultConsequenceExceptionHandler.java:23)
	at org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:943)
	at org.drools.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:885)
	at org.drools.common.DefaultAgenda.fireAllRules(DefaultAgenda.java:1086)
	at org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:660)
	at org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:627)
	at org.drools.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeSessionImpl.java:183)
	at com.principal.health.rules.impl.DroolsRuleSetImpl.fireRuleflow(DroolsRuleSetImpl.java:91)
	... 23 more
Caused by: [Error: drools.retract($wrappedNetwork): null]
[Near : {... Unknown ....}]
             ^
[Line: 1, Column: 0]
	at org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.compileGetChain(ReflectiveAccessorOptimizer.java:374)
	at org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.optimizeAccessor(ReflectiveAccessorOptimizer.java:138)
	at org.mvel2.ast.ASTNode.getReducedValueAccelerated(ASTNode.java:133)
	at org.mvel2.MVELRuntime.execute(MVELRuntime.java:85)
	at org.mvel2.compiler.CompiledExpression.getValue(CompiledExpression.java:104)
	at org.mvel2.MVEL.executeExpression(MVEL.java:978)
	at org.drools.base.mvel.MVELConsequence.evaluate(MVELConsequence.java:87)
	at org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:934)
	... 29 more
Caused by: java.lang.reflect.InvocationTargetException
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:79)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:618)
	at org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.getMethod(ReflectiveAccessorOptimizer.java:931)
	at org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.compileGetChain(ReflectiveAccessorOptimizer.java:316)
	... 36 more
Caused by: java.lang.AssertionError: null
	at org.junit.Assert.fail(Assert.java:69)
	at org.junit.Assert.assertTrue(Assert.java:32)
	at org.junit.Assert.assertTrue(Assert.java:41)
	at com.principal.health.rules.impl.available.MemberNetworkXFormRulesRuleId6Test$2.objectRetracted(MemberNetworkXFormRulesRuleId6Test.java:221)
	at org.drools.impl.StatefulKnowledgeSessionImpl$WorkingMemoryEventListenerWrapper.objectRetracted(StatefulKnowledgeSessionImpl.java:501)
	at org.drools.event.WorkingMemoryEventSupport.fireObjectRetracted(WorkingMemoryEventSupport.java:89)
	at org.drools.common.AbstractWorkingMemory.retract(AbstractWorkingMemory.java:1186)
	at org.drools.base.DefaultKnowledgeHelper.retract(DefaultKnowledgeHelper.java:158)
	at org.drools.base.DefaultKnowledgeHelper.retract(DefaultKnowledgeHelper.java:172)
	... 42 more

SDG



-----Message Disclaimer-----

This e-mail message is intended only for the use of the individual or
entity to which it is addressed, and may contain information that is
privileged, confidential and exempt from disclosure under applicable law.
If you are not the intended recipient, any dissemination, distribution or
copying of this communication is strictly prohibited. If you have
received this communication in error, please notify us immediately by
reply email to Connect at principal.com and delete or destroy all copies of
the original message and attachments thereto. Email sent to or from the
Principal Financial Group or any of its member companies may be retained
as required by law or regulation.

Nothing in this message is intended to constitute an Electronic signature
for purposes of the Uniform Electronic Transactions Act (UETA) or the
Electronic Signatures in Global and National Commerce Act ("E-Sign")
unless a specific statement to the contrary is included in this message.

While this communication may be used to promote or market a transaction
or an idea that is discussed in the publication, it is intended to provide
general information about the subject matter covered and is provided with
the understanding that The Principal is not rendering legal, accounting,
or tax advice. It is not a marketed opinion and may not be used to avoid
penalties under the Internal Revenue Code. You should consult with
appropriate counsel or other advisors on all matters pertaining to legal,
tax, or accounting obligations and requirements.





More information about the rules-users mailing list