Hello, I'm new to drools and have problems with globals or with the different behaviour of drools depending on how the globals are specified.
I have the following simple rule: global String test rule "Global" when then System.out.println(test); end If i run the rule with: KnowledgeBase kb = getKnowledgeBase("global.drl"); StatelessKnowledgeSession ses = kb.newStatelessKnowledgeSession(); ses.setGlobal("test2", "foo"); ses.execute(""); I get the expected result of null printed but if I use commands: KnowledgeBase kb = getKnowledgeBase("global.drl"); StatelessKnowledgeSession ses = kb.newStatelessKnowledgeSession(); List<Command<?>> cmds = new ArrayList<Command<?>>(); cmds.add(CommandFactory.newSetGlobal("test2", "bar")); cmds.add(CommandFactory.newInsert("")); ses.execute(CommandFactory.newBatchExecution(cmds)); I get java.lang.RuntimeException: Unexpected global [test2] Why is the behaviour different and which one is correct? Regards, Samuli -- Remion Oy Etävalvontajärjestelmät liiketoiminnan Samuli Saarinen tehostamiseen gsm +358 (0)50 3560075 fax +358 (0)3 2125064 www.remion.com _______________________________________________ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users