This page last changed on Oct 25, 2013 by juha.

I get the following error in dev.log from one of my rules:


2013-10-20 22:32:49,942 ERROR [Polling thread for sensor: EA_rainfall]: Error in executing rule : org.drools.reteoo.BetaMemory cannot be cast to org.drools.reteoo.AlphaNode$AlphaMemory -- Event org.openremote.controller.model.event.CustomState@34b46507 not processed!
java.lang.ClassCastException: org.drools.reteoo.BetaMemory cannot be cast to org.drools.reteoo.AlphaNode$AlphaMemory
	at org.drools.reteoo.AlphaNode.assertObject(AlphaNode.java:140)
	at org.drools.reteoo.CompositeObjectSinkAdapter.doPropagateAssertObject(CompositeObjectSinkAdapter.java:450)
	at org.drools.reteoo.CompositeObjectSinkAdapter.propagateAssertObject(CompositeObjectSinkAdapter.java:378)
	at org.drools.reteoo.CompositeObjectSinkAdapter.propagateAssertObject(CompositeObjectSinkAdapter.java:360)
	at org.drools.reteoo.ObjectTypeNode.assertObject(ObjectTypeNode.java:190)
	at org.drools.reteoo.EntryPointNode.assertObject(EntryPointNode.java:145)
	at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:1174)
	at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:1123)
	at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:917)
	at org.drools.impl.StatefulKnowledgeSessionImpl.insert(StatefulKnowledgeSessionImpl.java:251)
	at org.openremote.controller.statuscache.rules.RuleEngine.push(RuleEngine.java:170)
	at org.openremote.controller.statuscache.EventProcessorChain.push(EventProcessorChain.java:188)
	at org.openremote.controller.statuscache.StatusCache.update(StatusCache.java:260)
	at org.openremote.controller.model.sensor.Sensor.update(Sensor.java:342)
	at org.openremote.controller.protocol.http.HttpGetCommand.run(HttpGetCommand.java:274)
	at java.lang.Thread.run(Thread.java:679)

Any idea what is causing this and how it can be fixed? The rule itself is:

rule "Rain push message"
when
  $e: Event(source=="EA_rainfall")
  not EA_raining()
then
  Double r = Double.parseDouble($e.getValue().toString());
  if(r>0)
  {
    insert(new EA_raining());
    String message = "Rain : "+r+" mm";
    NMA_message n = new NMA_message();
    n.setApiKey("XXXXXXXXXXXXX");
    n.setEvent("Eindhoven Airport Weather");
    n.setDesc(message);
    n.setPriority(2);
    n.setDevKey(null);
    insert(n);
  }
end

I have even more this kind of errors from drools:


2013-10-23 19:23:52,363 ERROR [Polling Sensor Thread ID = 102305, Name ='Nightmode']: Root Cause: 

java.lang.ClassCastException: org.drools.reteoo.BetaMemory cannot be cast to org.drools.core.util.ObjectHashSet
	at org.drools.reteoo.ObjectTypeNode.assertObject(ObjectTypeNode.java:181)
	at org.drools.reteoo.EntryPointNode.assertObject(EntryPointNode.java:145)
	at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:1174)
	at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:1123)
	at org.drools.base.DefaultKnowledgeHelper.insert(DefaultKnowledgeHelper.java:128)
	at org.drools.base.DefaultKnowledgeHelper.insert(DefaultKnowledgeHelper.java:122)
	at org.openremote.controller.protocol.Rule_myRuleNightOn_0.defaultConsequence(Rule_myRuleNightOn_0.java:7)
	at org.openremote.controller.protocol.Rule_myRuleNightOn_0DefaultConsequenceInvoker.evaluate(Rule_myRuleNightOn_0DefaultConsequenceInvoker.java:24)
	at org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:917)
	at org.drools.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:856)
	at org.drools.common.DefaultAgenda.fireAllRules(DefaultAgenda.java:1071)
	at org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:785)
	at org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:751)
	at org.drools.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeSessionImpl.java:218)
	at org.openremote.controller.statuscache.rules.RuleEngine.push(RuleEngine.java:178)
	at org.openremote.controller.statuscache.EventProcessorChain.push(EventProcessorChain.java:188)
	at org.openremote.controller.statuscache.StatusCache.update(StatusCache.java:260)
	at org.openremote.controller.model.sensor.Sensor.update(Sensor.java:342)
	at org.openremote.controller.model.sensor.Sensor$DeviceReader.run(Sensor.java:608)
	at java.lang.Thread.run(Thread.java:679)
2013-10-23 19:24:04,617 ERROR [Polling Sensor Thread ID = 102305, Name ='Nightmode']: Error in executing rule : rule: myRuleNightOn
 -- Event Switch Event (ID = 102305, Source = 'Nightmode', Switch Value = 'on', Switch State = ON) not processed!
org.drools.runtime.rule.ConsequenceException: rule: myRuleNightOn

	at org.drools.runtime.rule.impl.DefaultConsequenceExceptionHandler.handleException(DefaultConsequenceExceptionHandler.java:39)
	at org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:927)
	at org.drools.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:856)
	at org.drools.common.DefaultAgenda.fireAllRules(DefaultAgenda.java:1071)
	at org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:785)
	at org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:751)
	at org.drools.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeSessionImpl.java:218)
	at org.openremote.controller.statuscache.rules.RuleEngine.push(RuleEngine.java:178)
	at org.openremote.controller.statuscache.EventProcessorChain.push(EventProcessorChain.java:188)
	at org.openremote.controller.statuscache.StatusCache.update(StatusCache.java:260)
	at org.openremote.controller.model.sensor.Sensor.update(Sensor.java:342)
	at org.openremote.controller.model.sensor.Sensor$DeviceReader.run(Sensor.java:608)
	at java.lang.Thread.run(Thread.java:679)
Caused by: java.lang.ClassCastException: org.drools.reteoo.BetaMemory cannot be cast to org.drools.core.util.ObjectHashSet
	at org.drools.reteoo.ObjectTypeNode.assertObject(ObjectTypeNode.java:181)
	at org.drools.reteoo.EntryPointNode.assertObject(EntryPointNode.java:145)
	at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:1174)
	at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:1123)
	at org.drools.base.DefaultKnowledgeHelper.insert(DefaultKnowledgeHelper.java:128)
	at org.drools.base.DefaultKnowledgeHelper.insert(DefaultKnowledgeHelper.java:122)
	at org.openremote.controller.protocol.Rule_myRuleNightOn_0.defaultConsequence(Rule_myRuleNightOn_0.java:7)
	at org.openremote.controller.protocol.Rule_myRuleNightOn_0DefaultConsequenceInvoker.evaluate(Rule_myRuleNightOn_0DefaultConsequenceInvoker.java:24)
	at org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:917)
	... 11 more

They start to happen after some time when controller is running. After restart they are usually gone for some time. When these errors begin to show then my controller starts to act strange. Not everything is working as it should. Some new facts cannot be inserted, etc. I think that at this moment I have many threads with .fireAllRules() and Drools memory is full (I'm guessing here). I wish somebody with better knowledge of controller architecture can look at it.

Posted by aktur at Oct 24, 2013 10:28

Not sure whether there's anything in the controller that impacts this. A quick search of Drools issues on Google reveals that similar issue was fixed for the 5.1 release, although there were some suspicions that it may have re-surfaced in 5.5 release (but unconfirmed as far as I was able to tell). But there are no reports of this issue for the 5.1 release as far as I was able to find.

Posted by juha at Oct 25, 2013 00:00
Document generated by Confluence on Jun 05, 2016 09:32