Here is an example that shows how to use custom Java classes from the JBPM5 example described in http://community.jboss.org/people/bpmn2user/blog/2011/02/21/jbpm5-example-for-forms-with-variables.

 

Rajesh Chikhale has modified the bpmn file from the above example to access a custom Test class (http://community.jboss.org/people/bpmn2user/blog/2011/02/21/jbpm5-example-for-forms-with-variables#/?page=2) from 'Check Quantity' node.

 

 

It is typically required to access the custom application classes (e.g, read application model data, write to application database, include custom business logic etc) from a workflow application.

 

Here are two steps that are required to access the custom Test class from the BPM application.

 

1.) Access the custom class (com.sample.Test) from scipt node as shown in example below.

Make sure to include the fully-qualified Java class name (i.e, com.sample.Test) or include the package name using the 'imports' tab shown below.

ScreenHunter_01 Mar. 14 22.07.gif

2.) Create a jar for all the custom Java classes, e.g, com.sample.Test and copy the jar file into server's CLASSPATH. For example, it can be one of the options as shown below:

 

Copy the jar file into gwt-console-server war file  ( ..gwt-console-server\WEB-INF\lib)

or Copy the jar file into appserver's lib direcory (JBOSS_HOME\server\default\lib for JBOSS or TOMCAT_HOME\lib for TOMCAT)