From: Liliana P. <lil...@gm...> - 2006-12-10 17:34:58
|
Consider the following files : 1)Dynamo_rules_test.java 2)Manager.java 3) ForAllManager.java 4)BooleanWrapper.java 5)StringWrapper.java 6)NumberWrapper.java ----------------------------------------------------- and consider two simple rules: rule "Regola 3" agenda-group "b2"; salience 3; no-loop true; when f2 : ForAllManager( id == "b2") && n1 : NumberWrapper(id=="n1") && eval(n1.getValue() < 100) then System.out.println(n1.getValue()); retract(n1); if (f2.getCursor().hasNextSelection() == true) f2.esegui(); else { assert (new BooleanWrapper(f2.getId(),true); retract(f2);} end rule "Regola 3.x" agenda-group "b2"; salience 3; no-loop true; when f2: ForAllManager( id == "b2") && n1 : NumberWrapper(id== "n1") && eval(!(n1.getValue() < 100)) then assert(new BooleanWrapper(f2.getId(),false)); retract(n1); retract(f2); end When the system has to assert the object BooleanWrapper in the WorkingMemory, I get the following errors: java.lang.NullPointerException at org.drools.rule.BoundVariableConstraint.isAllowed(Unknown Source) at org.drools.common.BetaNodeBinder.isAllowed(Unknown Source) at org.drools.reteoo.LeftInputAdapterNode.assertObject(Unknown Source) at org.drools.reteoo.ObjectSource.propagateAssertObject(Unknown Source) at org.drools.reteoo.ObjectTypeNode.assertObject(Unknown Source) at org.drools.reteoo.Rete.assertObject(Unknown Source) at org.drools.reteoo.ReteooRuleBase.assertObject(Unknown Source) at org.drools.reteoo.ReteooWorkingMemory.doAssertObject(Unknown Source) at org.drools.common.AbstractWorkingMemory.assertObject(Unknown Source) at org.drools.base.DefaultKnowledgeHelper.assertObject(Unknown Source) at org.drools.base.DefaultKnowledgeHelper.assertObject(Unknown Source) at it.polimi.forAllAnnidati.Rule_Regola_3_x_0.consequence(Rule_Regola_3_x_0.java:12) at it.polimi.forAllAnnidati.Rule_Regola_3_x_0ConsequenceInvoker.evaluate(Rule_Regola_3_x_0ConsequenceInvoker.java:24) at org.drools.common.DefaultAgenda.fireActivation(Unknown Source) at org.drools.common.DefaultAgenda.fireNextItem(Unknown Source) at org.drools.common.AbstractWorkingMemory.fireAllRules(Unknown Source) at org.drools.common.AbstractWorkingMemory.fireAllRules(Unknown Source) at it.polimi.forAllAnnidati.ForAllManager.esegui(ForAllManager.java:118) at it.polimi.forAllAnnidati.ForAllManager.esegui(ForAllManager.java:107) at it.polimi.forAllAnnidati.Manager.esegui(Manager.java:126) at it.polimi.forAllAnnidati.Dynamo_rules_test.main(Dynamo_rules_test.java:56) Exception in thread "main" org.drools.spi.ConsequenceException: java.lang.NullPointerException at org.drools.common.DefaultAgenda.fireActivation(Unknown Source) at org.drools.common.DefaultAgenda.fireNextItem(Unknown Source) at org.drools.common.AbstractWorkingMemory.fireAllRules(Unknown Source) at org.drools.common.AbstractWorkingMemory.fireAllRules(Unknown Source) at it.polimi.forAllAnnidati.ForAllManager.esegui(ForAllManager.java:118) at it.polimi.forAllAnnidati.ForAllManager.esegui(ForAllManager.java:107) at it.polimi.forAllAnnidati.Manager.esegui(Manager.java:126) at it.polimi.forAllAnnidati.Dynamo_rules_test.main(Dynamo_rules_test.java:56) Caused by: java.lang.NullPointerException at org.drools.rule.BoundVariableConstraint.isAllowed(Unknown Source) at org.drools.common.BetaNodeBinder.isAllowed(Unknown Source) at org.drools.reteoo.LeftInputAdapterNode.assertObject(Unknown Source) at org.drools.reteoo.ObjectSource.propagateAssertObject(Unknown Source) at org.drools.reteoo.ObjectTypeNode.assertObject(Unknown Source) at org.drools.reteoo.Rete.assertObject(Unknown Source) at org.drools.reteoo.ReteooRuleBase.assertObject(Unknown Source) at org.drools.reteoo.ReteooWorkingMemory.doAssertObject(Unknown Source) at org.drools.common.AbstractWorkingMemory.assertObject(Unknown Source) at org.drools.base.DefaultKnowledgeHelper.assertObject(Unknown Source) at org.drools.base.DefaultKnowledgeHelper.assertObject(Unknown Source) at it.polimi.forAllAnnidati.Rule_Regola_3_x_0.consequence(Rule_Regola_3_x_0.java:12) at it.polimi.forAllAnnidati.Rule_Regola_3_x_0ConsequenceInvoker.evaluate(Rule_Regola_3_x_0ConsequenceInvoker.java:24) ... 8 more Any ideas??? Liliana |