Hi
 i have a problem that seems to me quite similar to this http://drools.46999.n3.nabble.com/rules-users-Exception-when-using-retract-td4023520.html (i cannot reply to this post, don't Know why)

In my case exception is

java.lang.NullPointerException
    at ConditionEvaluator9935e5dba4084774a05641a0448cd694.evaluate(Unknown Source)
    at org.drools.rule.constraint.MvelConstraint.evaluate(MvelConstraint.java:200)
    at org.drools.rule.constraint.MvelConstraint.isAllowedCachedLeft(MvelConstraint.java:169)
    at org.drools.common.DoubleBetaConstraints.isAllowedCachedLeft(DoubleBetaConstraints.java:88)
    at org.drools.reteoo.NotNode.assertLeftTuple(NotNode.java:78)
    at org.drools.reteoo.CompositeLeftTupleSinkAdapter.doPropagateAssertLeftTuple(CompositeLeftTupleSinkAdapter.java:232)
    at org.drools.reteoo.CompositeLeftTupleSinkAdapter.propagateAssertLeftTuple(CompositeLeftTupleSinkAdapter.java:89)
    at org.drools.reteoo.JoinNode.propagateFromLeft(JoinNode.java:107)
    at org.drools.reteoo.JoinNode.assertLeftTuple(JoinNode.java:95)
    at org.drools.reteoo.CompositeLeftTupleSinkAdapter.doPropagateAssertLeftTuple(CompositeLeftTupleSinkAdapter.java:232)
    at org.drools.reteoo.CompositeLeftTupleSinkAdapter.createAndPropagateAssertLeftTuple(CompositeLeftTupleSinkAdapter.java:116)
    at org.drools.reteoo.LeftInputAdapterNode.assertObject(LeftInputAdapterNode.java:154)
    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 it.eximia.meerkat.re.core.RuleEngine.executeSession(RuleEngine.java:212)
    at it.eximia.meerkat.re.core.RuleEngine.run(RuleEngine.java:180)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:439)
    at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:317)
    at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:150)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:98)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:180)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:204)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
    at java.lang.Thread.run(Thread.java:662)
|#]

[#|2014-06-07T04:05:11.418+0200|WARNING|sun-appserver2.1|RuleEngine|_ThreadID=25;_ThreadName=pool-5-thread-1;_RequestID=b189af67-c681-411d-ad8c-44f1ec1646bf;|errore nel Rule Engine
Exception executing consequence for rule "temperatura normale" in it.sure.template: java.lang.NullPointerException
    at org.drools.runtime.rule.impl.DefaultConsequenceExceptionHandler.handleException(DefaultConsequenceExceptionHandler.java:39)
    at org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:1297)
    at org.drools.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:1221)
    at org.drools.common.DefaultAgenda.fireAllRules(DefaultAgenda.java:1456)
    at org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:710)
    at org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:674)
    at org.drools.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeSessionImpl.java:230)
    at it.eximia.meerkat.re.core.RuleEngine.executeSession(RuleEngine.java:215)
    at it.eximia.meerkat.re.core.RuleEngine.run(RuleEngine.java:180)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:439)
    at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:317)
    at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:150)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:98)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:180)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:204)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
    at java.lang.Thread.run(Thread.java:662)
Caused by: java.lang.NullPointerException
    at org.drools.core.util.index.LeftTupleIndexHashTable.remove(LeftTupleIndexHashTable.java:370)
    at org.drools.reteoo.NotNode.retractLeftTuple(NotNode.java:214)
    at org.drools.reteoo.CompositeLeftTupleSinkAdapter.doPropagateRetractLeftTuple(CompositeLeftTupleSinkAdapter.java:250)
    at org.drools.reteoo.CompositeLeftTupleSinkAdapter.propagateRetractRightTuple(CompositeLeftTupleSinkAdapter.java:165)
    at org.drools.reteoo.JoinNode.retractRightTuple(JoinNode.java:184)
    at org.drools.reteoo.ObjectTypeNode.retractObject(ObjectTypeNode.java:283)
    at org.drools.reteoo.EntryPointNode.retractObject(EntryPointNode.java:354)
    at org.drools.common.NamedEntryPoint.retract(NamedEntryPoint.java:568)
    at org.drools.base.DefaultKnowledgeHelper.retract(DefaultKnowledgeHelper.java:357)
    at it.sure.template.Rule_temperatura_normale_53fab538df67455491288390ebd5c29c.defaultConsequence(Rule_temperatura_normale_53fab538df67455491288390ebd5c29c.java:49)
    at it.sure.template.Rule_temperatura_normale_53fab538df67455491288390ebd5c29cDefaultConsequenceInvokerGenerated.evaluate(Unknown Source)
    at it.sure.template.Rule_temperatura_normale_53fab538df67455491288390ebd5c29cDefaultConsequenceInvoker.evaluate(Unknown Source)
    at org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:1287)
    ... 16 more
|#]



i'm using drools 5.5.0 Final

here is the rule, (i removed some statements don't seems relevant)


rule "temperatura normale"
salience -2
when
    $nowTimestamp : ExecutionTimestamp()
    $event: ScalarEvent(name == "TEMPERATURE_EVENT", $creation: creationDateTime, $uuid : sensorUUID ) from entry-point "event"
    not(ScalarEvent(name == "TEMPERATURE_EVENT", creationDateTime.time < $creation.getTime(), sensorUUID == $uuid) from entry-point "event")   
    $sensor: EnvironmentalSensor(sensorUUID == $event.sensorUUID, $sensor.type.keyId == "TEMP_ENV_TYPE", $sensor.assessable == true)
    $temperature1: Number( floatValue >=  Float.valueOf($sensor.getPropertyValue("min")) ) from $event.measure
    $temperature2: Number( floatValue <=  Float.valueOf($sensor.getPropertyValue("max")) ) from $event.measure
    $sensorInAlarm: SensorInAlarm (sensorUUID == $uuid)
then
                    ConcurrentHashMap<String, String> statusInfo = sensorCache.get($sensor.getId().toString());
                    SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
                    long sensorId = $sensor.getId();
                    Date alarmTimestamp = $event.getCreationDateTime();
                    String measure = $event.getMeasure() + "";
                    String alarmType = "TEMPERATURE_OK";
                    statusInfo.put("eventMeasure", measure);
                    statusInfo.put("eventTimestamp", formatter.format(alarmTimestamp));
                    $sensorInAlarm.setEventTimestamp(alarmTimestamp);
                    $sensorInAlarm.setEventMeasure(measure);
                    update($sensorInAlarm);
                    sensorCache.update($sensor.getId().toString(), statusInfo);
                    RuleEngineLogger.log(RuleEngineLoggerLevel.INFO, "normale");
                    retract($event);
end




 The exception does not immediately occur sometimes it  takes days before occurs

Rule is fire when event
TEMPERATURE_EVENT occurs.  TEMPERATURE_EVENT is a measure from a thermometer, i have a dispather that  simultaneously sends 10 measures (coming from 10 different sensors), then dispatcher stops sending data  for few minutes then it sends again new 10 measures, an so on.


Same situation for me: When the exception is thrown, it looks like that the event is not removed from the knowledge base (I watch the number of events in the knowledge base – fact count)

I more than 10 rules, fired every 1s

Any help would be appreciated

Sara


















--
Eximia Srl
Sara Didaci
Application Engineer
Eximia S.r.l.
Via Sassari, 3
09123 Cagliari - Italy
Tel +39 070 7966776
Fax +39 070 680904
Mob +39 328 4660322
Email sara.didaci@eximia.it
Web www.eximia.it

Eximia č un'azienda certificata ISO 9001
Image
Il contenuto di questa e-mail e dei file allegati č RISERVATO e da considerarsi utilizzabile solamente dalla persona o ente al quale č indirizzato. Se avete ricevuto questa e-mail per errore, siete pregati di rimandarla al mittente e di eliminarla. (Legge italiana 196/2003).

The content of this e-mail and any files is CONFIDENTIAL and intended solely for the use of the individual or entity to whom it is addressed. If you have received this e-mail in error, please return it to the sender and delete it. (Italian Law 196/2003).