[rules-users] Exception on at org.drools.reteoo.LeftTuple.get(LeftTuple.java:300) drools 5.0.1

Vincent LEGENDRE vincent.legendre at eurodecision.com
Fri May 18 08:54:28 EDT 2012


When using "or", only one pattern of the or expression will be bound. 
So, at runtime, onlty one variable $p1 or $p2 exists, and the other is null so the NPE at runtime. 

By the way, I can't see you are using a or here, as you test exactly the same things ... 

----- Mail original -----

De: "Joana Lopes" <joanpl at gmail.com> 
À: rules-users at lists.jboss.org 
Envoyé: Vendredi 18 Mai 2012 13:14:19 
Objet: [rules-users] Exception on at org.drools.reteoo.LeftTuple.get(LeftTuple.java:300) drools 5.0.1 

Hi There, 
I'm new to drools and i'm having a problem with a rule which has an OR: 

/* Rule 25_OFF -------------------------------------------------------------------------------- */ 


rule "25_OFF" 
when 
$p1:InferenceFactValue( param!=null, param.parameterName == "sonar_8_cm", $v1:param.valueFloat >= 10 ) or 
$p2:InferenceFactValue( param!=null, param.parameterName == "sonar_8_cm", $v2:param.valueFloat >= 10 ) 
then 
InferenceUtils.log( LogLevel.DEBUG, InferenceUtils.DROOLS_RULE, "Global Clock: " + InferenceDateUtils.dateString( globalClock, false ), true, false ); 
InferenceUtils.log( LogLevel.DEBUG, InferenceUtils.DROOLS_RULE, "\t\tRegra 25_OFF " + "25", true, false ); 
InferenceFactValue[] params = {$p1, $p2}; 
RuleFire.addEndAlarm( inferenceAgent, droolsEngine, "AlarmPackage", "25", "25", params, globalClock ); 
end 


No errors in knowledge builder 




What happens is: 



org.drools.runtime.rule.ConsequenceException: java.lang.NullPointerException 
at org.drools.runtime.rule.impl.DefaultConsequenceExceptionHandler.handleException(DefaultConsequenceExceptionHandler.java:23) 
at org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:943) 
at org.drools.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:885) 
at org.drools.common.DefaultAgenda.fireAllRules(DefaultAgenda.java:1086) 
at org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:660) 
at org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:627) 
at org.drools.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeSessionImpl.java:183) 
at pt.holos.dva.agents.inference.process.DroolsInferenceEngine.fireAllRules(DroolsInferenceEngine.java:644) 
at pt.holos.dva.agents.inference.process.DroolsInferenceEngine.receiveDataFromBuffer(DroolsInferenceEngine.java:342) 
at pt.holos.dva.agents.inference.process.BufferedDataReceiver.sendDataToDrools(BufferedDataReceiver.java:454) 
at pt.holos.dva.agents.inference.process.BufferedDataReceiver.run(BufferedDataReceiver.java:68) 
Caused by: java.lang.NullPointerException 
at org.drools.reteoo.LeftTuple.get(LeftTuple.java:300) 
at AlarmPackage.Rule_25_OFF_0ConsequenceInvoker.evaluate(Rule_25_OFF_0ConsequenceInvoker.java:15) 
at org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:934) 
... 9 more 




I've tried to see the source code and the declaration in org.drools.reteoo.LeftTuple.get(LeftTuple.java:300) is null. Can you give me some pointers please? 


Thank you, 
Joana P Lopes 

-- 

LinkedIn - http://pt.linkedin.com/in/joanpl 
My Bla Bla Bla: http://joanpl.blogspot.com 
....................................................... 
The intuitive mind is a sacred gift and the rational mind is a faithful servant. We have created a society that honors the servant and has forgotten the gift. Albert Einstein. 
"Doubt is not a pleasant condition, but certainty is absurd." 
Voltaire 



_______________________________________________ 
rules-users mailing list 
rules-users at lists.jboss.org 
https://lists.jboss.org/mailman/listinfo/rules-users 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20120518/27b88b26/attachment.html 


More information about the rules-users mailing list