[rules-users] ConsequenceException when using modify

Vakimshaar jean.logeart at gmail.com
Thu Feb 16 10:34:27 EST 2012


Hi everybody,

I have been struggling with a problem for a few hours now. 

Basically, what I am trying to do is set a default value to variable1 in a
first rule. Then executes an other rule that checks the value of variable1
and set variable2 to a specific value under some conditions. Right now, my
rules go like this :

rule "First rule: default"
	salience 10
	lock-on-active true
	when
		$myObject : MyObject()
	then
		modify($myObject) {
			setVariable1(defaultValue);
		}
end

rule "Second rule"
	salience 0
	lock-on-active false
	when
		$myObject : MyObject(variable1 == defaultValue)
	then
		$myObject.setVariable2(value2);
end

When those rules are executed, an exception is thrown : 
org.drools.runtime.rule.ConsequenceException: rule: First rule: default
...
Caused by: java.lang.NullPointerException

When I remove the "modify" in the first rule, the exception is not thrown
but obviously the second rule is not properly executed ...

What is the problem ? What am I doing wrong ?

Thanks for your help!
Vak'

--
View this message in context: http://drools.46999.n3.nabble.com/ConsequenceException-when-using-modify-tp3750604p3750604.html
Sent from the Drools: User forum mailing list archive at Nabble.com.



More information about the rules-users mailing list