jBPM 6 script task 'Action'

333 views
Skip to first unread message

sina.re...@gmail.com

unread,
May 21, 2015, 5:43:08 AM5/21/15
to jbpm-...@googlegroups.com
Hi 
I have a script task node in my process definition, and I want to do a little complicated operations inside it, more than manipulation of process variables. I decided to write a class and proper methods to do that, and then call them from inside code I wrote inside 'Action' of this user task node. First, please tell me how to that in the right way, and after that, if there is a better alternative for that, please let me know it.
I wrote something like:
           MyClass x = new MyClass();
           x.myMethod();

in the action and chose the javaDialect, and wrote something like:
          import com.MyClass;

in the import tab of action for the script task. But when I run the app, I see this error:

java.lang.IllegalArgumentException: Cannot add asset: Process Compilation error com.MyClass cannot be resolved to a type
com.MyClass cannot be resolved to a type,

It takes place in the line I want to add asset to RuntimeEnvironment to get RuntimeManager from it:
      		RuntimeEnvironment runtimeEnvironment = RuntimeEnvironmentBuilder.Factory.get()
                .newDefaultBuilder()
                .entityManagerFactory(emf)
                .userGroupCallback(myUserGroupCallback)  
                .addAsset(
                        ResourceFactory.newClassPathResource("Sample.bpmn"),
                        ResourceType.BPMN2)	                       
                .get();	

How should I import a class and then use its methods inside action of a script task?
Is there another way to do some machine task in certain places of a flow?

Neeraj Pandey

unread,
Dec 8, 2015, 2:32:15 AM12/8/15
to jBPM Setup
Have you found the solution? If yes please share.

Philip Wattenbarger

unread,
Dec 16, 2015, 10:18:51 AM12/16/15
to jBPM Setup
You need to create a jar with maven in a seperate project, add the jar as a dependency.
Then add the class as an import and then the class will be available.

Philip
Reply all
Reply to author
Forward
0 new messages