Registering a Spring Bean in Process Application with Shared Engine

Hey Guys,

I’m sure I am doing something stupid here, but I am having trouble getting a Spring Bean to register within my Process Application.

Environment : Tomcat running the Shared engine.
For simplicity, I am using the invoice demo (pulled from here)
I want to be able to register a Spring Bean inside the invoice process application.
I have created an applicationContext.xml and placed it in webapp/WEB-INF
The applicationContext.xml contains the following entries:

<context:annotation-config />

Notice that the GDHSpringBean simply references one of the JavaDelegate classes from the invoice app.
I then added a script task execution listener to a BPMN task:

   <camunda:executionListener event="start">
           <camunda:script scriptFormat="javascript">GDHSpringBean.execute(execution);</camunda:script>
   </camunda:executionListener>

But when I run the task, I get an error indicating e bean is not found:

Caused by: javax.script.ScriptException: ReferenceError: “GDHSpringBean” is not defined in at line number 1

What am I missing?
Thanks,
Greg

An update, it’s not that the spring bean isnt being registered, it appears to be working fine if I use a delegate expression (${GDHSpringBean}), it seems the bean is just not visible inside an execution script listener.

Seems this is a known limitation:

https://app.camunda.com/jira/browse/CAM-4222

I had a look into the code and I agree with your assessment.

Aleksander: Hi <@U02Q8G1G136>,
With the 8.1 release (October), we brought the Process Instance Modification feature. This can help you to repair process instances that ended up in the wrong state by repeating or skipping steps. You can easily move running flow nodes, add new or cancel existing ones via Operate UI.
Did you have a chance to check this feature? Does it work as expected or do you miss something there?

I’m curious about your feedback :wink:

Josh Wulf: Ref: https://docs.camunda.io/docs/components/concepts/process-instance-modification/

@jwulf it looks like the old lady is slowly going crazy