I am getting runtime exception with these temporal operator changes when I
compile the knowledge base using a knowledge agent. If I compile the drl
using:
KnowledgeBuilder kb = KnowledgeBuilderFactory.newKnowledgeBuilder();
kb.add(ResourceFactory.newFileResource(path), ResourceType.DRL); // path
is the .drl file
if (kb.hasErrors()) {
System.out.println(kb.getErrors().toString());
}
KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
kbase.addKnowledgePackages(kb.getKnowledgePackages());
and create a stateless knowledge session using the kbase, then at runtime I
do not get any errors.
however, if I build the knowledge base using:
agent = KnowledgeAgentFactory.newKnowledgeAgent(agentName);
agent.applyChangeSet(ResourceFactory.newClassPathResource(path)); // path
is to change set including only the above .drl file
return agent.getKnowledgeBase();
the package compiles, but at runtime, the same tests that worked fine for
the KnowledgeBuilder package instead get a NPE:
java.lang.NullPointerException
at
org.drools.base.evaluators.BeforeEvaluatorDefinition$BeforeEvaluator.evaluateCachedLeft(BeforeEvaluatorDefinition.java:347)
at
org.drools.rule.VariableRestriction.isAllowedCachedLeft(VariableRestriction.java:115)
at
org.drools.rule.VariableConstraint.isAllowedCachedLeft(VariableConstraint.java:115)
at
org.drools.common.SingleBetaConstraints.isAllowedCachedLeft(SingleBetaConstraints.java:127)
at
org.drools.reteoo.FromNode.checkConstraintsAndPropagate(FromNode.java:269)
at org.drools.reteoo.FromNode.assertLeftTuple(FromNode.java:133)
at
org.drools.reteoo.CompositeLeftTupleSinkAdapter.doPropagateAssertLeftTuple(CompositeLeftTupleSinkAdapter.java:232)
at
org.drools.reteoo.CompositeLeftTupleSinkAdapter.propagateAssertLeftTuple(CompositeLeftTupleSinkAdapter.java:91)
at
org.drools.reteoo.FromNode.checkConstraintsAndPropagate(FromNode.java:274)
at org.drools.reteoo.FromNode.assertLeftTuple(FromNode.java:133)
at
org.drools.reteoo.CompositeLeftTupleSinkAdapter.doPropagateAssertLeftTuple(CompositeLeftTupleSinkAdapter.java:232)
at
org.drools.reteoo.CompositeLeftTupleSinkAdapter.createAndPropagateAssertLeftTuple(CompositeLeftTupleSinkAdapter.java:118)
at
org.drools.reteoo.LeftInputAdapterNode.assertObject(LeftInputAdapterNode.java:154)
at
org.drools.reteoo.SingleObjectSinkAdapter.propagateAssertObject(SingleObjectSinkAdapter.java:59)
at org.drools.reteoo.AlphaNode.assertObject(AlphaNode.java:134)
at
org.drools.reteoo.SingleObjectSinkAdapter.propagateAssertObject(SingleObjectSinkAdapter.java:59)
at org.drools.reteoo.AlphaNode.assertObject(AlphaNode.java:134)
at
org.drools.reteoo.SingleObjectSinkAdapter.propagateAssertObject(SingleObjectSinkAdapter.java:59)
at
org.drools.reteoo.ObjectTypeNode.assertObject(ObjectTypeNode.java:193)
at
org.drools.reteoo.EntryPointNode.assertObject(EntryPointNode.java:191)
at
org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:332)
at
org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:293)
at
org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:905)
at
org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:864)
at
org.drools.impl.StatefulKnowledgeSessionImpl.insert(StatefulKnowledgeSessionImpl.java:255)
at
org.drools.impl.StatelessKnowledgeSessionImpl.execute(StatelessKnowledgeSessionImpl.java:303)
at
com.abclegal.rules.AbstractRulesUnit.executeWorkflow(AbstractRulesUnit.java:215)
at
com.abclegal.rules.RulesApplyInstructionUnit.testFileAtCourtCheckpointToWithOldDate(RulesApplyInstructionUnit.java:73)
--
View this message in context:
http://drools.46999.n3.nabble.com/rules-users-Date-arithmetic-in-when-par...
Sent from the Drools: User forum mailing list archive at
Nabble.com.