Integration Vaadin and Activiti BPM by Spring framework

In some of my project in the past I remembered that in order to do a business flow we need to do it manually in the coding level so that it gives your project  risk when you are managing  big project since business process in the organization might change during your software development and for sure it is not good for your development.

Finally, I found a simple tools called JBoss BPM 3.0 on that time, This tools was so good and useful helping the software designer integrating the business process defined by the business with the application code. Playing with the BPM is so fun. Lately, I found an application called Activiti BPM. Put some hand on it for several days give me a lot of fun. Since then I use this BPM as my base engine to manage the process management. I think it is time to share some basic after 1 years worked on it.

I will explain the very basic configuration to integrate Vaadin and Activiti with spring framework.

1. Setup your eclipse and Jboss AS configuration

2. Setup a Vaadin project from Maven

3. Configure your web.xml as below to enable the spring bean injection

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi=""
 xmlns="" xmlns:web=""
 id="WebApp_ID" version="2.5">
 <display-name>Vaadin Web Application</display-name>
 <description>Vaadin production mode</description>


 <servlet-name>Vaadin Application Servlet</servlet-name>
 <description>Vaadin application class to start</description>
 <servlet-name>Vaadin Application Servlet</servlet-name>

2. Configure the applicationContext-spring.xml to manage the activiti bean creation and database connection

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns=""
 xmlns:xsi="" xmlns:neo4j=""
 <context:spring-configured />
 <context:annotation-config />

<context:component-scan base-package="study.ActivitiExclusive" />
 <bean id="dataSource"
 <property name="targetDataSource">
 <bean class="org.springframework.jdbc.datasource.SimpleDriverDataSource">
 <property name="url" value="jdbc:mysql://localhost:3306/activiti" />
 <property name="driverClass" value="com.mysql.jdbc.Driver" />
 <property name="username" value="root" />
 <property name="password" value="*****" />

<bean id="transactionManager"
 <property name="dataSource" ref="dataSource" />

<bean id="processEngineConfiguration" class="org.activiti.spring.SpringProcessEngineConfiguration">
 <property name="databaseType" value="mysql" />
 <property name="dataSource" ref="dataSource" />
 <property name="transactionManager" ref="transactionManager" />
 <property name="databaseSchemaUpdate" value="true" />
 <property name="history" value="full" />
 <property name="jobExecutorActivate" value="false" />
 <property name="deploymentResources" value="/WEB-INF/MyProcess.bpmn" />


<bean id="processEngine" class="org.activiti.spring.ProcessEngineFactoryBean">
 <property name="processEngineConfiguration" ref="processEngineConfiguration" />

<bean id="repositoryService" factory-bean="processEngine"
 factory-method="getRepositoryService" />
 <bean id="runtimeService" factory-bean="processEngine"
 factory-method="getRuntimeService" />
 <bean id="taskService" factory-bean="processEngine"
 factory-method="getTaskService" />
 <bean id="historyService" factory-bean="processEngine"
 factory-method="getHistoryService" />
 <bean id="managementService" factory-bean="processEngine"
 factory-method="getManagementService" />
 <bean id="identityService" factory-bean="processEngine"
 factory-method="getIdentityService" />

<bean id="Printing" class="study.ActivitiExclusive.Printing" />



3. Configure your maven POM to enable the all library completed

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="" xmlns:xsi=""
 <name>Vaadin Web Application</name>



 <name>Activiti Repository</name>




5. Create a simple activiti BPM as a sample “MyProcess.BPMN” in the WEB-INF directory



<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="" xmlns:xsi="" xmlns:activiti="" xmlns:bpmndi="" xmlns:omgdc="" xmlns:omgdi="" typeLanguage="" expressionLanguage="" targetNamespace="">
 <process id="process1" name="process1">
 <startEvent id="startevent1" name="Start"></startEvent>
 <userTask id="usertask1" name="Approve"></userTask>
 <sequenceFlow id="flow1" name="" sourceRef="startevent1" targetRef="usertask1"></sequenceFlow>
 <endEvent id="endevent1" name="End"></endEvent>
 <serviceTask id="servicetask1" name="Service Task" activiti:expression="#{Printing.printMessage()}" ></serviceTask>
 <sequenceFlow id="flow2" name="" sourceRef="usertask1" targetRef="servicetask1"></sequenceFlow>
 <userTask id="usertask2" name="Makan2"></userTask>
 <sequenceFlow id="flow3" name="" sourceRef="servicetask1" targetRef="usertask2"></sequenceFlow>
 <endEvent id="endevent2" name="End"></endEvent>
 <sequenceFlow id="flow4" name="" sourceRef="usertask2" targetRef="endevent2"></sequenceFlow>
 <bpmndi:BPMNDiagram id="BPMNDiagram_process1">
 <bpmndi:BPMNPlane bpmnElement="process1" id="BPMNPlane_process1">
 <bpmndi:BPMNShape bpmnElement="startevent1" id="BPMNShape_startevent1">
 <omgdc:Bounds height="35" width="35" x="170" y="40"></omgdc:Bounds>
 <bpmndi:BPMNShape bpmnElement="usertask1" id="BPMNShape_usertask1">
 <omgdc:Bounds height="55" width="105" x="140" y="210"></omgdc:Bounds>
 <bpmndi:BPMNShape bpmnElement="endevent1" id="BPMNShape_endevent1">
 <omgdc:Bounds height="35" width="35" x="460" y="220"></omgdc:Bounds>
 <bpmndi:BPMNShape bpmnElement="servicetask1" id="BPMNShape_servicetask1">
 <omgdc:Bounds height="55" width="105" x="300" y="210"></omgdc:Bounds>
 <bpmndi:BPMNShape bpmnElement="usertask2" id="BPMNShape_usertask2">
 <omgdc:Bounds height="55" width="105" x="460" y="210"></omgdc:Bounds>
 <bpmndi:BPMNShape bpmnElement="endevent2" id="BPMNShape_endevent2">
 <omgdc:Bounds height="35" width="35" x="620" y="220"></omgdc:Bounds>
 <bpmndi:BPMNEdge bpmnElement="flow1" id="BPMNEdge_flow1">
 <omgdi:waypoint x="187" y="75"></omgdi:waypoint>
 <omgdi:waypoint x="192" y="210"></omgdi:waypoint>
 <bpmndi:BPMNEdge bpmnElement="flow2" id="BPMNEdge_flow2">
 <omgdi:waypoint x="245" y="237"></omgdi:waypoint>
 <omgdi:waypoint x="300" y="237"></omgdi:waypoint>
 <bpmndi:BPMNEdge bpmnElement="flow3" id="BPMNEdge_flow3">
 <omgdi:waypoint x="405" y="237"></omgdi:waypoint>
 <omgdi:waypoint x="460" y="237"></omgdi:waypoint>
 <bpmndi:BPMNEdge bpmnElement="flow4" id="BPMNEdge_flow4">
 <omgdi:waypoint x="565" y="237"></omgdi:waypoint>
 <omgdi:waypoint x="620" y="237"></omgdi:waypoint>


6. Finally in the application  I can autowire all the necessary activity bean from the spring context. (Please refer on how to create the injection for vaadin in my previous article)

package study.ActivitiExclusive;
import org.activiti.engine.IdentityService;
import org.activiti.engine.RepositoryService;
import org.activiti.engine.RuntimeService;
import org.activiti.engine.TaskService;
import org.activiti.engine.runtime.Execution;
import org.activiti.engine.task.Task;
import org.springframework.beans.factory.annotation.Autowired;

import com.vaadin.ui.Window;

public class MyWindow extends Window {

 RepositoryService repositoryService;

 RuntimeService runtimeService;

 TaskService taskService;

 IdentityService identityService;
 public MyWindow() {




7. Yeah just follow the configuration above then you can start playing Activiti BPM with Vaadin. In the above configuration don’t forget that you should have configure your Mysql database with the specified schema and DB.


Have a nice try all …

11 thoughts on “Integration Vaadin and Activiti BPM by Spring framework

    1. Hi,
      Thanks for the comment. I think it is good to follow the steps given so that you can get the experience. If you have problem on setting up the integration just send me your question..

      1. Thanks for reply.

        Application running correctly but not showing any thing in the page, showing only blank page.

      2. Hi Bhimanna, The application is showing nothing in this tutorial as you can see in the MyWindow class is doing nothing except autowiring all the required fields to work with activity. Try to check either the field autowired is null or not. if the autowire is not null then you have done it. But dont create the check in the constructor, you should check after the class fully created.

  1. Hello…
    Thanks a lot for guide. It helps a lot. I have follow each n every steps but still getting following error..

    IOException parsing XML document from ServletContext resource [/WEB_INF/applicationContext-spring.xml]; nested exception is Could not open ServletContext resource [/WEB_INF/applicationContext-spring.xml]

    I searched on net to resolve this exception but didn’t get over it.
    Please help me. I am not getting where i am going wrong.

    applicationContext-spring.xml file is present in WEB_INF.

    n I have created Vaadin project from Maven.

    Please help. I am a fresher.

    1. Hi Minakshi,

      This error was caused by the statement of this in web.xml. the context tried to find the spring configuration in the “/WEB-INF/applicationContext-spring.xml”


      First check. Ensure the “applicationContext-spring.xml” is available in the specified folder.

      Second check. Ensure the file name spelling is correct as specified in the web.xml

  2. Hello,
    I m integrating the Activiti BPM with Vaadin 7. Here I have a simple BPM diagram which have only one service task. At the end of this service task, I want to change the vaadin view screen ( like getUI.getNavigator().navigateTo(“OtherUI”)).

    My question is – how to change the view from completion of service task? 🙂

    1. Hi Ashutosh,

      Thanks for writting comments on my blogs. Basically service task is an async background job which call a delegated java class. To wait this service task done you can create a receiving task for the service task. Vaadin application will wait at this point (try to create a thread for waiting). This thread which will be the UI navigator trigger. I’m sorry cannot give you any sample code but only the concept.

  3. Hello
    Thanks a lot for guide …
    I m integrating the Activiti with Vaadin
    but when i use the RepositoryService or (other @Autowired) i have an error: java.lang.NullPointerException …
    plz help

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s