[rules-users] MVEL Expression causing NPE in MVEL optimizer

womuji cmregister at gmail.com
Sat Feb 18 08:23:12 EST 2012


The NPE was caused by the call:
cmds.add(CommandFactory.newSetGlobal( "addressManager", addressManager,
true));
cmds.add(CommandFactory.newSetGlobal("fieldOperations", new HashMap<String,
AbstractField>(), true));

the addressManager is not available via this call, but if I switched all
Global setting via non-command API as

session.setGlobal( "addressManager", addressManager);	
session.setGlobal("fieldOperations", new HashMap<String, AbstractField>());

although they are available during rules' firing, they are not available as
part of ExecutionResults when I call

sessionResult.getValue("fieldOperations")

>From the API doc, it says:
"StatelessKnowledgeSessions support globals, scoped in a number of ways.
I'll cover the non-command way first, as commands are scoped to a specific
execution call. Globals can be resolved in three ways."

It seems either way should work, what I'm missing here?

Thanks.




--
View this message in context: http://drools.46999.n3.nabble.com/MVEL-Expression-causing-NPE-in-MVEL-optimizer-tp3733427p3756295.html
Sent from the Drools: User forum mailing list archive at Nabble.com.



More information about the rules-users mailing list