2 Replies Latest reply on Dec 18, 2013 11:11 AM by Andy McC

    jBPM global variables don't work when deployed via drools-guvnor

    Andy McC Newbie

      [Edit: Changed title in response to new information]




      I'm trying to set up some globals that will be visible across all of my processes.


      To test it I've created (in Designer) the attached diagram (TestGlobal.bpmn2) which

      • defines a single global string variable (globVar)
      • tries to set it using a script task and the command kcontext.getKnowledgeRuntime().setGlobal("globVar", "a value") (as stated in the manual).
      • tries to display it using kcontext.getKnowledgeRuntime().getGlobal("globVar").


      The process compiles but when I run it from gwt-console it throws a runtime error with the following text (full extract in error_message.txt, attached):

      • org.jbpm.workflow.instance.WorkflowRuntimeException: [defaultPackage.TestGlobal:69 - Set global:2] -- unable to execute Action: Unexpected global [globVar]


      This suggests that globVar is not being declared/initialised in the drools session. (Also, in an earlier effort, the display task simply tried to print the value of globVar to the log using System.out.println("Global variable:" + globVar) but this version did not even compile, complaining that globVar did not resolve to a type.)


      I have now gone back to Eclipse and attached is an equivalent BPMN diagram (TestGlobalEclipse.bpmn) created using the default 5.4.0.Final Eclipse tools and tested in Eclipse using GlobalTest.java (also attached). This version works without problem!


      Given that it works in Eclipse but the equivalent process  via drools-guvnor does not I'm concluding (rightly or wrongly) that this is a drools-guvnor or Designer bug.


      So far as I can tell I've worked in accordance with the manual - but I realise there may be a key step I've missed.


      Can anyone help with a workaround? I'll be submitting a Jira.




      Andy McC


      My config: jBPM-5.4.0.Final, Windows 7 and 8, working via drools-guvnor and jbpm-console (not eclipse, apart from the attached example)


      Message was edited by: Andy McC following further testing of the problem via Eclipse