Users,
I am trying to follow this example in the main drools documentation:
http://docs.jboss.org/drools/release/5.4.0.Final/drools-fusion-docs/html_...
I have a simple rule that listens for an event, and provide an average over
a 3-event sliding window. I see 2 issues.
_DRL = "rule myRule\n"
_DRL += "when\n"
_DRL += "> $avg: Number() from accumulate (\n"
_DRL += "> DatapointProxy( key == 'testUsedMemPct', $val :
valueAsDouble ) over window:length( 3 ), \n"
_DRL += "> average( $val ) )\n"
_DRL += "then\n"
_DRL += " handleRule( rule, ruleResource, userdata, $avg );\n"
_DRL += "end\n"
1) my rule evaluates try for every event, and gives me the value of the
event vs the avg. So if i send 50, 60, 70, my handleRule function is a
called 3 times with new event array(java.lang.Object, [50.0]),
array(java.lang.Object, [60.0]), array(java.lang.Object, [70.0])
2) On the 4th event, I get the following NPE (includes JSON of target
object):
Msg:
{"DatapointProxy":{"value":"80","modTime":1362148018519,"uuid":"87163fc1-b072-4311-8cb4-b604d6d874ed","ownerUUID":"90d9d3d1-dd57-42b7-beba-4927c5551409","generatorUUID":"a8dfd038-c7a6-4317-8bf5-7911d7dbb759","key":"testUsedMemPct","name":"Test
Mem Value","managerUUID":"3beb7ead-f351-42a3-a4a4-38425b061a5a"}}
Error:
java.lang.NullPointerException
java.lang.NullPointerException
at
org.drools.rule.SlidingLengthWindow.assertFact(SlidingLengthWindow.java:115)
at
org.drools.rule.BehaviorManager.assertFact(BehaviorManager.java:94)
at org.drools.reteoo.WindowNode.assertObject(WindowNode.java:167)
at
org.drools.reteoo.CompositeObjectSinkAdapter.doPropagateAssertObject(CompositeObjectSinkAdapter.java:497)
at
org.drools.reteoo.CompositeObjectSinkAdapter.propagateAssertObject(CompositeObjectSinkAdapter.java:382)
at
org.drools.reteoo.ObjectTypeNode.assertObject(ObjectTypeNode.java:235)
at
org.drools.reteoo.EntryPointNode.assertObject(EntryPointNode.java:240)
at
org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:350)
at
org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:311)
at
org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:903)
at
org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:847)
at
org.drools.impl.StatefulKnowledgeSessionImpl.insert(StatefulKnowledgeSessionImpl.java:269)
at
com.codemettle.sherpa.cam.jms.JMSMessageListenerForDrools.injectEvent(JMSMessageListenerForDrools.java:128)
at
com.codemettle.sherpa.cam.jms.JMSMessageListenerForDrools.onMessage(JMSMessageListenerForDrools.java:105)
at
org.apache.activemq.ActiveMQMessageConsumer.dispatch(ActiveMQMessageConsumer.java:1321)
at
org.apache.activemq.ActiveMQSessionExecutor.dispatch(ActiveMQSessionExecutor.java:131)
at
org.apache.activemq.ActiveMQSessionExecutor.iterate(ActiveMQSessionExecutor.java:202)
at
org.apache.activemq.thread.PooledTaskRunner.runTask(PooledTaskRunner.java:129)
at
org.apache.activemq.thread.PooledTaskRunner$1.run(PooledTaskRunner.java:47)
at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
I would appreciate some help figuring out what the issue is. Is there
something fishy in my rule?
I thank you in advance for your consideration and help
--
View this message in context:
http://drools.46999.n3.nabble.com/Accumulate-Over-window-average-NullPoin...
Sent from the Drools: User forum mailing list archive at
Nabble.com.