JEE 7 Activiti integration


To enable activiti in our JEE project the following steps are needed:

  1. Add the maven dependencies — include spring-context
  2. Add log4j configuration
  3. Add the activiti configuration for CDI integration activiti.cfg.xml
  4. Add your first activiti workflow
  5. Add an activiti compatible data source to your container
  6. Deploy and run it

Git Project.

Eclipse Plugin

To install the activiti designer just add the following update site to eclipse: for more details just check the documentation.

Add activity maven dependencies

For JEE we want not only to add the normal dependencies for the core lib but also the CDI integration which allows us later on to access our CDI or EJB beans. In addition, we need one more dependency to have the JNDI bean.

Add log4j configuration

Before we start with activiti we should add the log4j.xml configuration into src/main/resources which would allow us to see any error in activiti, otherwise we are blind.

Add activiti configuration

Add to the src/main/resources folder the default activiti.cfg.xml configuration which is picked up automatically by the activiti CDI integration to create the process engine.

Note: We set here the TransactionManager and the ThreadFactory to ensure threads and the transaction is managed by the JEE container. You may also provide the executor which is configured in the JEE container by you. As the ManagedAsyncJobExecutor is just creating a ThreadPoolExecutor under the hood.

Deploy a workflow

Overall where to ways to deploy your workflows. Either using XML or programatically. Here I will use the last to demonstrate the injection and usage in a very simple (not production ready) way:

Start a workflow

Note: The process ID is defined in the process bpmn file.

Activiti support currently following DB

Add to your JEE container one JNDI data source of one of the following supported database types. In this sample we name it jdbc/activiti.

Note: The default Sample DB of Payara is a Apache Derby DB and is not supported by Activiti.

This list is taken from version 6.0.

  • H2
  • HSQL
  • DB2

Paul Sterl has written 20 articles

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">