JBoss Community

Cannot get jBPM global variables to work

created by Andy McC in jBPM - View the full discussion

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

 

To test it I've created 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 but 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 it is not sufficient to declare globVar as a global at the process level.

 

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.

 

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

 

Can anyone help?

 

Thanks

 

Andy McC

 

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

Reply to this message by going to Community

Start a new discussion in jBPM at Community