Raible's Wiki

Raible Designs
Wiki Home
Recent Changes


  - Korean
  - Chinese
  - Italian
  - Japanese

QuickStart Guide
  - Chinese
  - French
  - German
  - Italian
  - Korean
  - Portuguese
  - Spanish
  - Japanese

User Guide
  - Korean
  - Chinese

  - Chinese
  - German
  - Italian
  - Korean
  - Portuguese
  - Spanish

  - Korean

Latest Downloads

Other Applications

Struts Resume
Security Example
Struts Menu

Set your name in

Edit this page

Referenced by

JSPWiki v2.2.33


Hide Menu


Part I: Integrating jBPM into AppFuse - Integrate jBPM Support (via Spring-Modules) into AppFuse.
Part II: Integrating jBPM into AppFuse Part Deux - Setup AppFuse/jBPM in Eclipse, model defintions using the Jbpm Process Designer.
Part III: Integrating jBPM into AppFuse Part Trois - Enhance defintions to support tasks, users, schedule and injecting spring beans into actions (Under Construction).

About this tutorial

This is the 2nd tutorial of a 3 part series. The tutorial covers how to setup AppFuse/Jbpm in Eclipse and model definitions using the Jbpm Process Designer. Before proceeding further please have your basic configuration setup from Part I.

Table of Contents

  • [1] Install Process Design Tool for Eclispe
  • [2] Create a simple Process Defintion
  • [3] Write test case to validate Process Definition execution
  • [4] Apply patch to prevent process definition redployment across server restart

[#1] Install Process Design Tool for Eclispe

See AppFuseEclipse on how to configure AppFuse with Eclipse.
Download JBoss jBPM Process Designer Plugin. Version 3.0.13 is used for this tutorial. Copy the features and plugins directory from the unzipped file to your %ECLIPSE_HOME% directory. Start Eclipse from command line by issuing eclipse -clean. Voila!

[#2] Create a simple Process Defintion

Before creating process definitions lets create a package where we will save our process defintions.

Create the following package:

All the processes will live under the .process package. Whenever you create a new defintion, the process designer creates a new package with that name.
Start off by creating a simple test process.

i) Create a new process definition file.



ii) Give the process a name - test.



Reference the definition in org/appfuse/jbpm/dao/hibernate/applicationContext-hibernate.xml:

 <!-- jBPM Configuration -->
    <bean id="jbpmConfig" class="org.springmodules.workflow.jbpm31.LocalJbpmConfigurationFactoryBean">
	<!-- pass in existing sessionFactory -->
		<property name="sessionFactory" ref="jbpmSessionFactory"/>
		<property name="configuration" value="org/appfuse/jbpm/jbpm.cfg.xml"/>
		<property name="processDefinitions">
				<ref local="testProcess"/>
		<property name="createSchema" value="false"/>

	<bean id="testProcess" class="org.springmodules.workflow.jbpm31.definition.ProcessDefinitionFactoryBean">
		<property name="definitionLocation" value="org/appfuse/jbpm/process/test/processdefinition.xml"/>

1) Click on one of each process states(Start, State, End) on the left panel and draw them in.

2) Choose transition from the left panel and click thru all the states to establish flow.


Congratulations you have written your 1st process defintion!

[#3] Write test case to validate Process Definition execution

There is a test case in the previous article. Create ProcessTest.java class under test/dao/org/appfuse/jbpm/dao and copy the code from the previous installment with the following modifications:

protected void onSetUpBeforeTransaction() throws Exception {
      definition = context.getGraphSession().findLatestProcessDefinition("test");

public void testProcessDefinition() throws Exception {

      ProcessDefinition def = context.getGraphSession().findLatestProcessDefinition("test");
      assertNotNull("Definition should not be null", def);

public void testTransitions() throws Exception {
        assertEquals("Instance is in 'helloWorld' state", inst.getRootToken().getNode().getName(), "helloWorld");

Recompile and run JUnit test. Execute ant refresh.


Select the project's context menu by right clicking on the project root(jbpmtutorial) and choosing the refresh option.


Select Project from the Eclispe's menu above and choose clean.


Now you can run the ProcessTest. Ensure ProcessTest is open and selected and then choose Run As -> JUnit Test


Upon execution JbpmConfiguration will deploy the 'test' process definition, and run through the tests.


Congratulations you have deployed and tested a process defintion!

[#4] Apply patch to prevent process definition redployment across server restart

For production usage it is not ideal to redeploy process definitions on server restarts. Once you have stable definitions there is no need for redeployment. You can apply the following patch to have the JbpmConfiguration not deploy process definitions on restarts, instead have it redeployed only if the definition on the file system is out of sync with the database.

Modify the jbpmConfig bean in org/appfuse/jbpm/dao/hibernate/applicationContext-hibernate.xml to reflect the new overwritten CustomLocalJbpmConfigurationFactoryBean .
 <!-- jBPM Configuration -->
    <bean id="jbpmConfig" class="org.appfuse.jbpm.config.CustomLocalJbpmConfigurationFactoryBean">

Create the following package:

Create CustomLocalJbpmConfigurationFactoryBean.java in above package and copy code from CustomLocalJbpmConfigurationFactoryBean.java(info) into it.
Voila! When you restart the server the process defintion wont be redeployed.

newdef3.jpg Info on newdef3.jpg 23693 bytes
CustomLocalJbpmConfigurationFactoryBean.java Info on CustomLocalJbpmConfigurationFactoryBean.java 5625 bytes
test3.jpg Info on test3.jpg 11009 bytes
newdef2.jpg Info on newdef2.jpg 30770 bytes
test2.jpg Info on test2.jpg 32009 bytes
newdef4.jpg Info on newdef4.jpg 60839 bytes
newdef1.jpg Info on newdef1.jpg 50306 bytes
test5.jpg Info on test5.jpg 164921 bytes
test4.jpg Info on test4.jpg 84699 bytes
testpackage.jpg Info on testpackage.jpg 78539 bytes
test1.jpg Info on test1.jpg 107150 bytes

Go to top   Edit this page   More info...   Attach file...
This page last changed on 03-Mar-2007 08:02:16 MST by AmeerAhmed.