Sambhashanam
तकनीकी संभाषणम्
Navigation
  • Microsoft Technologies
  • Java Technologies
  • LAMP Technologies
  • Opensource
    • Microsoft Opensource
    • LAMP Opensource
    • Java Opensource
You are here: Home › Java Opensource › Setup and run first sample process using activiti
← Caused by: java.lang.ClassNotFoundException: org.springframework.beans.factory.NoUniqueBeanDefinitionException
JAX-WS web service on Tomcat →

Setup and run first sample process using activiti

July 28, 2013 | Filed under: Java Opensource, Java Technologies, Opensource and tagged with: activiti, activiti bpmn, activiti-spring, sample activiti process with human task and service task

I was learning activiti from last couple of days. This weekend, I thought to give it a try.

I developed a very simple workflow consisting of one Human Task and one Service Task to start with. The workflow looks like below:
Smple activiti workflow

I wanted to setup and execute the sample using Spring, hibernate and MySQL so that configurations can be re-used. I will provide step-by-step setup and execution.

1. Components Used
1.1 Activiti Engine
1.2 Spring
1.3 Hibernate
1.4 MySQL

2. Maven Dependencies (pom.xml)

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>
	<groupId>activiti-sample</groupId>
	<artifactId>activiti-sample</artifactId>
	<version>0.0.1-SNAPSHOT</version>
	<name>activiti-sample</name>
	<description>activiti-sample</description>
 
	<properties>
		<org.springframework.version>3.2.2.RELEASE</org.springframework.version>
		<org.hibernate.version>4.0.1.Final</org.hibernate.version>
		<org.hibernate.annotation.version>3.5.6-Final</org.hibernate.annotation.version>
		<junit.version>4.7.0</junit.version>
	</properties>
 
	<dependencies>
		<!-- Activiti Engine dependency -->
		<dependency>
			<groupId>org.activiti</groupId>
			<artifactId>activiti-engine</artifactId>
			<version>5.12</version>
		</dependency>
		<!-- Activiti Engine dependency for spring integration -->
		<dependency>
        	<groupId>org.activiti</groupId>
        	<artifactId>activiti-spring</artifactId>
        	<version>5.12</version>
      	</dependency>
      	<!-- Spring framework dependency -->
      	<dependency>
    		<groupId>org.springframework</groupId>
    		<artifactId>spring-beans</artifactId>
    		<version>${org.springframework.version}</version>
		</dependency> 
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-context</artifactId>
			<version>${org.springframework.version}</version>
		</dependency>
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-jdbc</artifactId>
			<version>${org.springframework.version}</version>
		</dependency>
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-tx</artifactId>
			<version>${org.springframework.version}</version>
		</dependency>
		<!-- HIbernate dependency -->
		<dependency>
			<groupId>org.hibernate</groupId>
			<artifactId>hibernate-core</artifactId>
			<version>${org.hibernate.version}</version>
		</dependency>
		<dependency>
			<groupId>org.hibernate</groupId>
			<artifactId>hibernate-entitymanager</artifactId>
			<version>${org.hibernate.version}</version>
		</dependency>
		<dependency>
			<groupId>org.hibernate</groupId>
			<artifactId>hibernate-annotations</artifactId>
			<version>${org.hibernate.annotation.version}</version>
		</dependency>
 
		<dependency>
			<groupId>org.hibernate</groupId>
			<artifactId>hibernate-annotations</artifactId>
			<version>${org.hibernate.annotation.version}</version>
		</dependency>
		<!-- Support for testing Spring applications with tools such as JUnit and 
			TestNG This artifact is generally always defined with a 'test' scope for 
			the integration testing framework and unit testing stubs -->
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-test</artifactId>
			<version>${org.springframework.version}</version>
			<scope>test</scope>
		</dependency>
		<!-- Object-to-Relation-Mapping (ORM) integration with Hibernate, JPA, 
			and iBatis. (depends on spring-core, spring-beans, spring-context, spring-tx) 
			Define this if you need ORM (org.springframework.orm.*) -->
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-orm</artifactId>
			<version>${org.springframework.version}</version>
		</dependency>
		<!-- Junit dependency -->
		<dependency>
			<groupId>junit</groupId>
			<artifactId>junit</artifactId>
			<version>4.11</version>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>mysql</groupId>
			<artifactId>mysql-connector-java</artifactId>
			<version>5.1.6</version>
		</dependency>
	</dependencies>
	<repositories>
		<!--Activiti is not available in maven central, thus has to add dependency  -->
		<repository>
			<id>Activiti</id>
			<url>https://maven.alfresco.com/nexus/content/groups/public</url>
		</repository>
		<repository>
			<id>Maven Central</id>
			<url>http://repo.maven.apache.org/maven2/</url>
		</repository>
 
	</repositories>
 
</project>

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>activiti-sample</groupId> <artifactId>activiti-sample</artifactId> <version>0.0.1-SNAPSHOT</version> <name>activiti-sample</name> <description>activiti-sample</description> <properties> <org.springframework.version>3.2.2.RELEASE</org.springframework.version> <org.hibernate.version>4.0.1.Final</org.hibernate.version> <org.hibernate.annotation.version>3.5.6-Final</org.hibernate.annotation.version> <junit.version>4.7.0</junit.version> </properties> <dependencies> <!-- Activiti Engine dependency --> <dependency> <groupId>org.activiti</groupId> <artifactId>activiti-engine</artifactId> <version>5.12</version> </dependency> <!-- Activiti Engine dependency for spring integration --> <dependency> <groupId>org.activiti</groupId> <artifactId>activiti-spring</artifactId> <version>5.12</version> </dependency> <!-- Spring framework dependency --> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-beans</artifactId> <version>${org.springframework.version}</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-context</artifactId> <version>${org.springframework.version}</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-jdbc</artifactId> <version>${org.springframework.version}</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-tx</artifactId> <version>${org.springframework.version}</version> </dependency> <!-- HIbernate dependency --> <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-core</artifactId> <version>${org.hibernate.version}</version> </dependency> <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-entitymanager</artifactId> <version>${org.hibernate.version}</version> </dependency> <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-annotations</artifactId> <version>${org.hibernate.annotation.version}</version> </dependency> <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-annotations</artifactId> <version>${org.hibernate.annotation.version}</version> </dependency> <!-- Support for testing Spring applications with tools such as JUnit and TestNG This artifact is generally always defined with a 'test' scope for the integration testing framework and unit testing stubs --> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-test</artifactId> <version>${org.springframework.version}</version> <scope>test</scope> </dependency> <!-- Object-to-Relation-Mapping (ORM) integration with Hibernate, JPA, and iBatis. (depends on spring-core, spring-beans, spring-context, spring-tx) Define this if you need ORM (org.springframework.orm.*) --> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-orm</artifactId> <version>${org.springframework.version}</version> </dependency> <!-- Junit dependency --> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.11</version> <scope>test</scope> </dependency> <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <version>5.1.6</version> </dependency> </dependencies> <repositories> <!--Activiti is not available in maven central, thus has to add dependency --> <repository> <id>Activiti</id> <url>https://maven.alfresco.com/nexus/content/groups/public</url> </repository> <repository> <id>Maven Central</id> <url>http://repo.maven.apache.org/maven2/</url> </repository> </repositories> </project>

3. Spring and hibernate configuration
3.1. DB settings (/db-config/database-config.properties)

jdbc.driverClassName=com.mysql.jdbc.Driver
jdbc.url=jdbc:mysql://localhost:3306/activiti
jdbc.username=root
jdbc.password=
hibernate.dialect=org.hibernate.dialect.MySQLDialect
hibernate.show_sql=true

3.2. Spring bean configuration (/spring-config/spring-hibernate-integeration-beans.xml)

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd">
 
	<bean
		class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
		<property name="location">
			<value>/db-config/database-config.properties</value>
		</property>
	</bean>
 
	<bean id="dataSource"
		class="org.springframework.jdbc.datasource.DriverManagerDataSource">
		<property name="driverClassName" value="${jdbc.driverClassName}" />
		<property name="url" value="${jdbc.url}" />
		<property name="username" value="${jdbc.username}" />
		<property name="password" value="${jdbc.password}" />
	</bean>
 
	<bean id="sessionFactory"
		class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
		<property name="dataSource">
			<ref bean="dataSource" />
		</property>
		<property name="hibernateProperties">
			<props>
				<prop key="hibernate.dialect">${hibernate.dialect}</prop>
				<prop key="hibernate.show_sql">${hibernate.show_sql}</prop>
			</props>
		</property>
	</bean>
	<bean id="transactionManager" class="org.springframework.orm.hibernate4.HibernateTransactionManager">
  		<property name="sessionFactory" ref="sessionFactory" />
	</bean>
 
 
</beans>

<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"> <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> <property name="location"> <value>/db-config/database-config.properties</value> </property> </bean> <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource"> <property name="driverClassName" value="${jdbc.driverClassName}" /> <property name="url" value="${jdbc.url}" /> <property name="username" value="${jdbc.username}" /> <property name="password" value="${jdbc.password}" /> </bean> <bean id="sessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean"> <property name="dataSource"> <ref bean="dataSource" /> </property> <property name="hibernateProperties"> <props> <prop key="hibernate.dialect">${hibernate.dialect}</prop> <prop key="hibernate.show_sql">${hibernate.show_sql}</prop> </props> </property> </bean> <bean id="transactionManager" class="org.springframework.orm.hibernate4.HibernateTransactionManager"> <property name="sessionFactory" ref="sessionFactory" /> </bean> </beans>

4. Activiti and Spring configuration (/spring-config/activiti-config-beans.xml)

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd">
 
	<bean id="processEngineConfiguration" class="org.activiti.spring.SpringProcessEngineConfiguration">
		<property name="dataSource" ref="dataSource" />
		<property name="transactionManager" ref="transactionManager" />
		<property name="databaseSchemaUpdate" value="true" />
		<property name="jobExecutorActivate" value="false" />
	</bean>
 
	<bean id="processEngine" class="org.activiti.spring.ProcessEngineFactoryBean">
		<property name="processEngineConfiguration" ref="processEngineConfiguration" />
	</bean>
 
	<bean id="runtimeService" factory-bean="processEngine"
		factory-method="getRuntimeService" />
	<bean id="taskService" factory-bean="processEngine"
		factory-method="getTaskService" />
	<bean id="repositoryService" factory-bean="processEngine"
		factory-method="getRepositoryService" />
 
</beans>

<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"> <bean id="processEngineConfiguration" class="org.activiti.spring.SpringProcessEngineConfiguration"> <property name="dataSource" ref="dataSource" /> <property name="transactionManager" ref="transactionManager" /> <property name="databaseSchemaUpdate" value="true" /> <property name="jobExecutorActivate" value="false" /> </bean> <bean id="processEngine" class="org.activiti.spring.ProcessEngineFactoryBean"> <property name="processEngineConfiguration" ref="processEngineConfiguration" /> </bean> <bean id="runtimeService" factory-bean="processEngine" factory-method="getRuntimeService" /> <bean id="taskService" factory-bean="processEngine" factory-method="getTaskService" /> <bean id="repositoryService" factory-bean="processEngine" factory-method="getRepositoryService" /> </beans>

5. Import /spring-config/activiti-config-beans.xml and /spring-config/spring-hibernate-integeration-beans.xml into /spring-config/beans.xml

 <?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd">
 
	<import resource="classpath:spring-config/spring-hibernate-integeration-beans.xml"/>
	<import resource="classpath:spring-config/activiti-config-beans.xml"/>
</beans>

<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"> <import resource="classpath:spring-config/spring-hibernate-integeration-beans.xml"/> <import resource="classpath:spring-config/activiti-config-beans.xml"/> </beans>

6. Design the Process

6.1. Install the Activiti Designer for eclipse from below location: http://activiti.org/designer/update
6.2. Create a new diagram
Create Activiti Diagram

Create Activity Diagram

Create Activity Diagram

Create Activity Diagram

7. Create a Java Class to attach with service task

/**
 * 
 */
package com.sambhashanam.sample.activiti.delegate;
 
import org.activiti.engine.delegate.DelegateExecution;
import org.activiti.engine.delegate.JavaDelegate;
 
/**
 * @author Dhananjay Jha
 *
 */
public class ServiceClassDelegateSample implements JavaDelegate {
 
	/* (non-Javadoc)
	 * @see org.activiti.engine.delegate.JavaDelegate#execute(org.activiti.engine.delegate.DelegateExecution)
	 */
	public void execute(DelegateExecution delegateExecution) throws Exception {
 
		System.out.println("Executed process with key "+
							delegateExecution.getProcessBusinessKey()+
							" with process definition Id "+
							delegateExecution.getProcessDefinitionId()+
							" with process instance Id "+delegateExecution.getProcessInstanceId()+
							" and current task name is "+
							delegateExecution.getCurrentActivityName());
 
	}
 
}

/** * */ package com.sambhashanam.sample.activiti.delegate; import org.activiti.engine.delegate.DelegateExecution; import org.activiti.engine.delegate.JavaDelegate; /** * @author Dhananjay Jha * */ public class ServiceClassDelegateSample implements JavaDelegate { /* (non-Javadoc) * @see org.activiti.engine.delegate.JavaDelegate#execute(org.activiti.engine.delegate.DelegateExecution) */ public void execute(DelegateExecution delegateExecution) throws Exception { System.out.println("Executed process with key "+ delegateExecution.getProcessBusinessKey()+ " with process definition Id "+ delegateExecution.getProcessDefinitionId()+ " with process instance Id "+delegateExecution.getProcessInstanceId()+ " and current task name is "+ delegateExecution.getCurrentActivityName()); } }

8. Integrate Java Class with Service task

Attach Java Class with Service Task

9. Final content of bpmn (HumanAndServiceTaskExample.bpmn)

<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:activiti="http://activiti.org/bpmn" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:omgdc="http://www.omg.org/spec/DD/20100524/DC" xmlns:omgdi="http://www.omg.org/spec/DD/20100524/DI" typeLanguage="http://www.w3.org/2001/XMLSchema" expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://www.sambhashanam.org/humanandservicetaskexample">
  <process id="HumanAndServiceTaskExample" name="HumanAndServiceTaskExample.bpmn" isExecutable="true">
    <startEvent id="start" name="Start"></startEvent>
    <userTask id="HumanTaskExample" name="Human Task Example"></userTask>
    <sequenceFlow id="defaultFlow" sourceRef="start" targetRef="HumanTaskExample"></sequenceFlow>
    <serviceTask id="servicetask1" name="Service Task" activiti:class="com.sambhashanam.sample.activiti.delegate.ServiceClassDelegateSample"></serviceTask>
    <sequenceFlow id="moveToServiceTask" sourceRef="HumanTaskExample" targetRef="servicetask1"></sequenceFlow>
    <endEvent id="endevent1" name="End"></endEvent>
    <sequenceFlow id="endFlow" sourceRef="servicetask1" targetRef="endevent1"></sequenceFlow>
  </process>
  <bpmndi:BPMNDiagram id="BPMNDiagram_HumanAndServiceTaskExample">
    <bpmndi:BPMNPlane bpmnElement="HumanAndServiceTaskExample" id="BPMNPlane_HumanAndServiceTaskExample">
      <bpmndi:BPMNShape bpmnElement="start" id="BPMNShape_start">
        <omgdc:Bounds height="35.0" width="35.0" x="120.0" y="140.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="HumanTaskExample" id="BPMNShape_HumanTaskExample">
        <omgdc:Bounds height="55.0" width="105.0" x="200.0" y="130.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="servicetask1" id="BPMNShape_servicetask1">
        <omgdc:Bounds height="55.0" width="105.0" x="340.0" y="130.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="endevent1" id="BPMNShape_endevent1">
        <omgdc:Bounds height="35.0" width="35.0" x="480.0" y="140.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNEdge bpmnElement="defaultFlow" id="BPMNEdge_defaultFlow">
        <omgdi:waypoint x="155.0" y="157.0"></omgdi:waypoint>
        <omgdi:waypoint x="200.0" y="157.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="moveToServiceTask" id="BPMNEdge_moveToServiceTask">
        <omgdi:waypoint x="305.0" y="157.0"></omgdi:waypoint>
        <omgdi:waypoint x="340.0" y="157.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="endFlow" id="BPMNEdge_endFlow">
        <omgdi:waypoint x="445.0" y="157.0"></omgdi:waypoint>
        <omgdi:waypoint x="480.0" y="157.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
    </bpmndi:BPMNPlane>
  </bpmndi:BPMNDiagram>
</definitions>

<?xml version="1.0" encoding="UTF-8"?> <definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:activiti="http://activiti.org/bpmn" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:omgdc="http://www.omg.org/spec/DD/20100524/DC" xmlns:omgdi="http://www.omg.org/spec/DD/20100524/DI" typeLanguage="http://www.w3.org/2001/XMLSchema" expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://www.sambhashanam.org/humanandservicetaskexample"> <process id="HumanAndServiceTaskExample" name="HumanAndServiceTaskExample.bpmn" isExecutable="true"> <startEvent id="start" name="Start"></startEvent> <userTask id="HumanTaskExample" name="Human Task Example"></userTask> <sequenceFlow id="defaultFlow" sourceRef="start" targetRef="HumanTaskExample"></sequenceFlow> <serviceTask id="servicetask1" name="Service Task" activiti:class="com.sambhashanam.sample.activiti.delegate.ServiceClassDelegateSample"></serviceTask> <sequenceFlow id="moveToServiceTask" sourceRef="HumanTaskExample" targetRef="servicetask1"></sequenceFlow> <endEvent id="endevent1" name="End"></endEvent> <sequenceFlow id="endFlow" sourceRef="servicetask1" targetRef="endevent1"></sequenceFlow> </process> <bpmndi:BPMNDiagram id="BPMNDiagram_HumanAndServiceTaskExample"> <bpmndi:BPMNPlane bpmnElement="HumanAndServiceTaskExample" id="BPMNPlane_HumanAndServiceTaskExample"> <bpmndi:BPMNShape bpmnElement="start" id="BPMNShape_start"> <omgdc:Bounds height="35.0" width="35.0" x="120.0" y="140.0"></omgdc:Bounds> </bpmndi:BPMNShape> <bpmndi:BPMNShape bpmnElement="HumanTaskExample" id="BPMNShape_HumanTaskExample"> <omgdc:Bounds height="55.0" width="105.0" x="200.0" y="130.0"></omgdc:Bounds> </bpmndi:BPMNShape> <bpmndi:BPMNShape bpmnElement="servicetask1" id="BPMNShape_servicetask1"> <omgdc:Bounds height="55.0" width="105.0" x="340.0" y="130.0"></omgdc:Bounds> </bpmndi:BPMNShape> <bpmndi:BPMNShape bpmnElement="endevent1" id="BPMNShape_endevent1"> <omgdc:Bounds height="35.0" width="35.0" x="480.0" y="140.0"></omgdc:Bounds> </bpmndi:BPMNShape> <bpmndi:BPMNEdge bpmnElement="defaultFlow" id="BPMNEdge_defaultFlow"> <omgdi:waypoint x="155.0" y="157.0"></omgdi:waypoint> <omgdi:waypoint x="200.0" y="157.0"></omgdi:waypoint> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge bpmnElement="moveToServiceTask" id="BPMNEdge_moveToServiceTask"> <omgdi:waypoint x="305.0" y="157.0"></omgdi:waypoint> <omgdi:waypoint x="340.0" y="157.0"></omgdi:waypoint> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge bpmnElement="endFlow" id="BPMNEdge_endFlow"> <omgdi:waypoint x="445.0" y="157.0"></omgdi:waypoint> <omgdi:waypoint x="480.0" y="157.0"></omgdi:waypoint> </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> </definitions>

10. Create the Junit Test class

package org.activiti.designer.test;
 
import static org.junit.Assert.assertNotNull;
 
import java.io.FileInputStream;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
 
import javax.annotation.Resource;
 
import org.activiti.engine.RepositoryService;
import org.activiti.engine.RuntimeService;
import org.activiti.engine.TaskService;
import org.activiti.engine.runtime.ProcessInstance;
import org.activiti.engine.task.Task;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
 
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations={"/spring-config/beans.xml"})
public class ProcessHumanAndServiceTaskExampleTest {
 
	private String filename = "D:/junoprojects/activiti_samples/activiti-sample/HumanAndServiceTaskExample.bpmn";
	/**
	 * Inject repository service
	 */
	@Resource
	private RepositoryService repositoryService;
	/**
	 * Inject runtime service
	 */	
	@Resource
	private RuntimeService runtimeService;
 
	/**
	 * Inject task service
	 */	
	@Resource
	private TaskService taskService;
 
	@Test
	public void startProcess() throws Exception {
 
		/*
		 * Deploy the process
		 */
		repositoryService.createDeployment().enableDuplicateFiltering().addInputStream("HumanAndServiceTaskExample.bpmn20.xml",
				new FileInputStream(filename)).deploy();
 
		Map<String, Object> variableMap = new HashMap<String, Object>();
		variableMap.put("processStartedBy", "Dhananjay");
		ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("HumanAndServiceTaskExample", variableMap);
 
		assertNotNull(processInstance.getId());
		System.out.println("id " + processInstance.getId() + " "
				+ processInstance.getProcessDefinitionId());
	}
 
	@Test
	public void claimAndCompleteHumanTask() throws Exception {
		List<Task> tasks= taskService.createTaskQuery().processDefinitionKey("HumanAndServiceTaskExample").taskDefinitionKey("HumanTaskExample").list();
		for(Task task:tasks){
			taskService.claim(task.getId(), "DJ");
			Map<String, Object> variableMap = new HashMap<String, Object>();
			variableMap.put("HumanTaskCompletedBy", "DJ");
			taskService.complete(task.getId(),variableMap);
		}
	}
}

package org.activiti.designer.test; import static org.junit.Assert.assertNotNull; import java.io.FileInputStream; import java.util.HashMap; import java.util.List; import java.util.Map; import javax.annotation.Resource; import org.activiti.engine.RepositoryService; import org.activiti.engine.RuntimeService; import org.activiti.engine.TaskService; import org.activiti.engine.runtime.ProcessInstance; import org.activiti.engine.task.Task; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations={"/spring-config/beans.xml"}) public class ProcessHumanAndServiceTaskExampleTest { private String filename = "D:/junoprojects/activiti_samples/activiti-sample/HumanAndServiceTaskExample.bpmn"; /** * Inject repository service */ @Resource private RepositoryService repositoryService; /** * Inject runtime service */ @Resource private RuntimeService runtimeService; /** * Inject task service */ @Resource private TaskService taskService; @Test public void startProcess() throws Exception { /* * Deploy the process */ repositoryService.createDeployment().enableDuplicateFiltering().addInputStream("HumanAndServiceTaskExample.bpmn20.xml", new FileInputStream(filename)).deploy(); Map<String, Object> variableMap = new HashMap<String, Object>(); variableMap.put("processStartedBy", "Dhananjay"); ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("HumanAndServiceTaskExample", variableMap); assertNotNull(processInstance.getId()); System.out.println("id " + processInstance.getId() + " " + processInstance.getProcessDefinitionId()); } @Test public void claimAndCompleteHumanTask() throws Exception { List<Task> tasks= taskService.createTaskQuery().processDefinitionKey("HumanAndServiceTaskExample").taskDefinitionKey("HumanTaskExample").list(); for(Task task:tasks){ taskService.claim(task.getId(), "DJ"); Map<String, Object> variableMap = new HashMap<String, Object>(); variableMap.put("HumanTaskCompletedBy", "DJ"); taskService.complete(task.getId(),variableMap); } } }

Hey its done!

Lets run the test case and see the console output

Hibernate: create table ACT_GE_PROPERTY ( 
NAME_ varchar(64), 
VALUE_ varchar(300), 
REV_ integer, 
primary key (NAME_) 
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin
Hibernate: insert into ACT_GE_PROPERTY 
values ('schema.version', '5.12', 1)
Hibernate: insert into ACT_GE_PROPERTY 
values ('schema.history', 'create(5.12)', 1)
Hibernate: insert into ACT_GE_PROPERTY 
values ('next.dbid', '1', 1)
Hibernate: create table ACT_GE_BYTEARRAY ( 
ID_ varchar(64), 
REV_ integer, 
NAME_ varchar(255), 
DEPLOYMENT_ID_ varchar(64), 
BYTES_ LONGBLOB, 
GENERATED_ TINYINT, 
primary key (ID_) 
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin
Hibernate: create table ACT_RE_DEPLOYMENT ( 
ID_ varchar(64), 
NAME_ varchar(255), 
CATEGORY_ varchar(255), 
DEPLOY_TIME_ timestamp, 
primary key (ID_) 
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin
Hibernate: create table ACT_RE_MODEL ( 
ID_ varchar(64) not null, 
REV_ integer, 
NAME_ varchar(255), 
KEY_ varchar(255), 
CATEGORY_ varchar(255), 
CREATE_TIME_ timestamp null, 
LAST_UPDATE_TIME_ timestamp null, 
VERSION_ integer, 
META_INFO_ varchar(4000), 
DEPLOYMENT_ID_ varchar(64), 
EDITOR_SOURCE_VALUE_ID_ varchar(64), 
EDITOR_SOURCE_EXTRA_VALUE_ID_ varchar(64), 
primary key (ID_) 
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin
Hibernate: create table ACT_RU_EXECUTION ( 
ID_ varchar(64), 
REV_ integer, 
PROC_INST_ID_ varchar(64), 
BUSINESS_KEY_ varchar(255), 
PARENT_ID_ varchar(64), 
PROC_DEF_ID_ varchar(64), 
SUPER_EXEC_ varchar(64), 
ACT_ID_ varchar(255), 
IS_ACTIVE_ TINYINT, 
IS_CONCURRENT_ TINYINT, 
IS_SCOPE_ TINYINT, 
IS_EVENT_SCOPE_ TINYINT, 
SUSPENSION_STATE_ integer, 
CACHED_ENT_STATE_ integer, 
primary key (ID_), 
unique ACT_UNIQ_RU_BUS_KEY (PROC_DEF_ID_, BUSINESS_KEY_) 
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin
Hibernate: create table ACT_RU_JOB ( 
ID_ varchar(64) NOT NULL, 
REV_ integer, 
TYPE_ varchar(255) NOT NULL, 
LOCK_EXP_TIME_ timestamp NULL, 
LOCK_OWNER_ varchar(255), 
EXCLUSIVE_ boolean, 
EXECUTION_ID_ varchar(64), 
PROCESS_INSTANCE_ID_ varchar(64), 
PROC_DEF_ID_ varchar(64), 
RETRIES_ integer, 
EXCEPTION_STACK_ID_ varchar(64), 
EXCEPTION_MSG_ varchar(4000), 
DUEDATE_ timestamp NULL, 
REPEAT_ varchar(255), 
HANDLER_TYPE_ varchar(255), 
HANDLER_CFG_ varchar(4000), 
primary key (ID_) 
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin
Hibernate: create table ACT_RE_PROCDEF ( 
ID_ varchar(64) not null, 
REV_ integer, 
CATEGORY_ varchar(255), 
NAME_ varchar(255), 
KEY_ varchar(255) not null, 
VERSION_ integer not null, 
DEPLOYMENT_ID_ varchar(64), 
RESOURCE_NAME_ varchar(4000), 
DGRM_RESOURCE_NAME_ varchar(4000), 
DESCRIPTION_ varchar(4000), 
HAS_START_FORM_KEY_ TINYINT, 
SUSPENSION_STATE_ integer, 
primary key (ID_) 
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin
Hibernate: create table ACT_RU_TASK ( 
ID_ varchar(64), 
REV_ integer, 
EXECUTION_ID_ varchar(64), 
PROC_INST_ID_ varchar(64), 
PROC_DEF_ID_ varchar(64), 
NAME_ varchar(255), 
PARENT_TASK_ID_ varchar(64), 
DESCRIPTION_ varchar(4000), 
TASK_DEF_KEY_ varchar(255), 
OWNER_ varchar(255), 
ASSIGNEE_ varchar(255), 
DELEGATION_ varchar(64), 
PRIORITY_ integer, 
CREATE_TIME_ timestamp, 
DUE_DATE_ datetime, 
SUSPENSION_STATE_ integer, 
primary key (ID_) 
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin
Hibernate: create table ACT_RU_IDENTITYLINK ( 
ID_ varchar(64), 
REV_ integer, 
GROUP_ID_ varchar(255), 
TYPE_ varchar(255), 
USER_ID_ varchar(255), 
TASK_ID_ varchar(64), 
PROC_INST_ID_ varchar(64), 
PROC_DEF_ID_ varchar(64), 
primary key (ID_) 
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin
Hibernate: create table ACT_RU_VARIABLE ( 
ID_ varchar(64) not null, 
REV_ integer, 
TYPE_ varchar(255) not null, 
NAME_ varchar(255) not null, 
EXECUTION_ID_ varchar(64), 
PROC_INST_ID_ varchar(64), 
TASK_ID_ varchar(64), 
BYTEARRAY_ID_ varchar(64), 
DOUBLE_ double, 
LONG_ bigint, 
TEXT_ varchar(4000), 
TEXT2_ varchar(4000), 
primary key (ID_) 
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin
Hibernate: create table ACT_RU_EVENT_SUBSCR ( 
ID_ varchar(64) not null, 
REV_ integer, 
EVENT_TYPE_ varchar(255) not null, 
EVENT_NAME_ varchar(255), 
EXECUTION_ID_ varchar(64), 
PROC_INST_ID_ varchar(64), 
ACTIVITY_ID_ varchar(64), 
CONFIGURATION_ varchar(255), 
CREATED_ timestamp not null, 
primary key (ID_) 
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin
Hibernate: create index ACT_IDX_EXEC_BUSKEY on ACT_RU_EXECUTION(BUSINESS_KEY_)
Hibernate: create index ACT_IDX_TASK_CREATE on ACT_RU_TASK(CREATE_TIME_)
Hibernate: create index ACT_IDX_IDENT_LNK_USER on ACT_RU_IDENTITYLINK(USER_ID_)
Hibernate: create index ACT_IDX_IDENT_LNK_GROUP on ACT_RU_IDENTITYLINK(GROUP_ID_)
Hibernate: create index ACT_IDX_EVENT_SUBSCR_CONFIG_ on ACT_RU_EVENT_SUBSCR(CONFIGURATION_)
Hibernate: create index ACT_IDX_VARIABLE_TASK_ID on ACT_RU_VARIABLE(TASK_ID_)
Hibernate: create index ACT_IDX_ATHRZ_PROCEDEF on ACT_RU_IDENTITYLINK(PROC_DEF_ID_)
Hibernate: alter table ACT_GE_BYTEARRAY 
add constraint ACT_FK_BYTEARR_DEPL 
foreign key (DEPLOYMENT_ID_) 
references ACT_RE_DEPLOYMENT (ID_)
Hibernate: alter table ACT_RE_PROCDEF 
add constraint ACT_UNIQ_PROCDEF 
unique (KEY_,VERSION_)
Hibernate: alter table ACT_RU_EXECUTION 
add constraint ACT_FK_EXE_PROCINST 
foreign key (PROC_INST_ID_) 
references ACT_RU_EXECUTION (ID_) on delete cascade on update cascade
Hibernate: alter table ACT_RU_EXECUTION 
add constraint ACT_FK_EXE_PARENT 
foreign key (PARENT_ID_) 
references ACT_RU_EXECUTION (ID_)
Hibernate: alter table ACT_RU_EXECUTION 
add constraint ACT_FK_EXE_SUPER 
foreign key (SUPER_EXEC_) 
references ACT_RU_EXECUTION (ID_)
Hibernate: alter table ACT_RU_EXECUTION 
add constraint ACT_FK_EXE_PROCDEF 
foreign key (PROC_DEF_ID_) 
references ACT_RE_PROCDEF (ID_)
Hibernate: alter table ACT_RU_IDENTITYLINK 
add constraint ACT_FK_TSKASS_TASK 
foreign key (TASK_ID_) 
references ACT_RU_TASK (ID_)
Hibernate: alter table ACT_RU_IDENTITYLINK 
add constraint ACT_FK_ATHRZ_PROCEDEF 
foreign key (PROC_DEF_ID_) 
references ACT_RE_PROCDEF(ID_)
Hibernate: alter table ACT_RU_IDENTITYLINK 
add constraint ACT_FK_IDL_PROCINST 
foreign key (PROC_INST_ID_) 
references ACT_RU_EXECUTION (ID_)
Hibernate: alter table ACT_RU_TASK 
add constraint ACT_FK_TASK_EXE 
foreign key (EXECUTION_ID_) 
references ACT_RU_EXECUTION (ID_)
Hibernate: alter table ACT_RU_TASK 
add constraint ACT_FK_TASK_PROCINST 
foreign key (PROC_INST_ID_) 
references ACT_RU_EXECUTION (ID_)
Hibernate: alter table ACT_RU_TASK 
add constraint ACT_FK_TASK_PROCDEF 
foreign key (PROC_DEF_ID_) 
references ACT_RE_PROCDEF (ID_)
Hibernate: alter table ACT_RU_VARIABLE 
add constraint ACT_FK_VAR_EXE 
foreign key (EXECUTION_ID_) 
references ACT_RU_EXECUTION (ID_)
Hibernate: alter table ACT_RU_VARIABLE 
add constraint ACT_FK_VAR_PROCINST 
foreign key (PROC_INST_ID_) 
references ACT_RU_EXECUTION(ID_)
Hibernate: alter table ACT_RU_VARIABLE 
add constraint ACT_FK_VAR_BYTEARRAY 
foreign key (BYTEARRAY_ID_) 
references ACT_GE_BYTEARRAY (ID_)
Hibernate: alter table ACT_RU_JOB 
add constraint ACT_FK_JOB_EXCEPTION 
foreign key (EXCEPTION_STACK_ID_) 
references ACT_GE_BYTEARRAY (ID_)
Hibernate: alter table ACT_RU_EVENT_SUBSCR 
add constraint ACT_FK_EVENT_EXEC 
foreign key (EXECUTION_ID_) 
references ACT_RU_EXECUTION(ID_)
Hibernate: alter table ACT_RE_MODEL 
add constraint ACT_FK_MODEL_SOURCE 
foreign key (EDITOR_SOURCE_VALUE_ID_) 
references ACT_GE_BYTEARRAY (ID_)
Hibernate: alter table ACT_RE_MODEL 
add constraint ACT_FK_MODEL_SOURCE_EXTRA 
foreign key (EDITOR_SOURCE_EXTRA_VALUE_ID_) 
references ACT_GE_BYTEARRAY (ID_)
Hibernate: alter table ACT_RE_MODEL 
add constraint ACT_FK_MODEL_DEPLOYMENT 
foreign key (DEPLOYMENT_ID_) 
references ACT_RE_DEPLOYMENT (ID_)
Hibernate: create table ACT_HI_PROCINST ( 
ID_ varchar(64) not null, 
PROC_INST_ID_ varchar(64) not null, 
BUSINESS_KEY_ varchar(255), 
PROC_DEF_ID_ varchar(64) not null, 
START_TIME_ datetime not null, 
END_TIME_ datetime, 
DURATION_ bigint, 
START_USER_ID_ varchar(255), 
START_ACT_ID_ varchar(255), 
END_ACT_ID_ varchar(255), 
SUPER_PROCESS_INSTANCE_ID_ varchar(64), 
DELETE_REASON_ varchar(4000), 
primary key (ID_), 
unique (PROC_INST_ID_), 
unique ACT_UNIQ_HI_BUS_KEY (PROC_DEF_ID_, BUSINESS_KEY_) 
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin
Hibernate: create table ACT_HI_ACTINST ( 
ID_ varchar(64) not null, 
PROC_DEF_ID_ varchar(64) not null, 
PROC_INST_ID_ varchar(64) not null, 
EXECUTION_ID_ varchar(64) not null, 
ACT_ID_ varchar(255) not null, 
TASK_ID_ varchar(64), 
CALL_PROC_INST_ID_ varchar(64), 
ACT_NAME_ varchar(255), 
ACT_TYPE_ varchar(255) not null, 
ASSIGNEE_ varchar(64), 
START_TIME_ datetime not null, 
END_TIME_ datetime, 
DURATION_ bigint, 
primary key (ID_) 
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin
Hibernate: create table ACT_HI_TASKINST ( 
ID_ varchar(64) not null, 
PROC_DEF_ID_ varchar(64), 
TASK_DEF_KEY_ varchar(255), 
PROC_INST_ID_ varchar(64), 
EXECUTION_ID_ varchar(64), 
NAME_ varchar(255), 
PARENT_TASK_ID_ varchar(64), 
DESCRIPTION_ varchar(4000), 
OWNER_ varchar(255), 
ASSIGNEE_ varchar(255), 
START_TIME_ datetime not null, 
CLAIM_TIME_ datetime, 
END_TIME_ datetime, 
DURATION_ bigint, 
DELETE_REASON_ varchar(4000), 
PRIORITY_ integer, 
DUE_DATE_ datetime, 
FORM_KEY_ varchar(255), 
primary key (ID_) 
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin
Hibernate: create table ACT_HI_VARINST ( 
ID_ varchar(64) not null, 
PROC_INST_ID_ varchar(64), 
EXECUTION_ID_ varchar(64), 
TASK_ID_ varchar(64), 
NAME_ varchar(255) not null, 
VAR_TYPE_ varchar(100), 
REV_ integer, 
BYTEARRAY_ID_ varchar(64), 
DOUBLE_ double, 
LONG_ bigint, 
TEXT_ varchar(4000), 
TEXT2_ varchar(4000), 
primary key (ID_) 
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin
Hibernate: create table ACT_HI_DETAIL ( 
ID_ varchar(64) not null, 
TYPE_ varchar(255) not null, 
PROC_INST_ID_ varchar(64), 
EXECUTION_ID_ varchar(64), 
TASK_ID_ varchar(64), 
ACT_INST_ID_ varchar(64), 
NAME_ varchar(255) not null, 
VAR_TYPE_ varchar(255), 
REV_ integer, 
TIME_ datetime not null, 
BYTEARRAY_ID_ varchar(64), 
DOUBLE_ double, 
LONG_ bigint, 
TEXT_ varchar(4000), 
TEXT2_ varchar(4000), 
primary key (ID_) 
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin
Hibernate: create table ACT_HI_COMMENT ( 
ID_ varchar(64) not null, 
TYPE_ varchar(255), 
TIME_ datetime not null, 
USER_ID_ varchar(255), 
TASK_ID_ varchar(64), 
PROC_INST_ID_ varchar(64), 
ACTION_ varchar(255), 
MESSAGE_ varchar(4000), 
FULL_MSG_ LONGBLOB, 
primary key (ID_) 
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin
Hibernate: create table ACT_HI_ATTACHMENT ( 
ID_ varchar(64) not null, 
REV_ integer, 
USER_ID_ varchar(255), 
NAME_ varchar(255), 
DESCRIPTION_ varchar(4000), 
TYPE_ varchar(255), 
TASK_ID_ varchar(64), 
PROC_INST_ID_ varchar(64), 
URL_ varchar(4000), 
CONTENT_ID_ varchar(64), 
primary key (ID_) 
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin
Hibernate: create index ACT_IDX_HI_PRO_INST_END on ACT_HI_PROCINST(END_TIME_)
Hibernate: create index ACT_IDX_HI_PRO_I_BUSKEY on ACT_HI_PROCINST(BUSINESS_KEY_)
Hibernate: create index ACT_IDX_HI_ACT_INST_START on ACT_HI_ACTINST(START_TIME_)
Hibernate: create index ACT_IDX_HI_ACT_INST_END on ACT_HI_ACTINST(END_TIME_)
Hibernate: create index ACT_IDX_HI_DETAIL_PROC_INST on ACT_HI_DETAIL(PROC_INST_ID_)
Hibernate: create index ACT_IDX_HI_DETAIL_ACT_INST on ACT_HI_DETAIL(ACT_INST_ID_)
Hibernate: create index ACT_IDX_HI_DETAIL_TIME on ACT_HI_DETAIL(TIME_)
Hibernate: create index ACT_IDX_HI_DETAIL_NAME on ACT_HI_DETAIL(NAME_)
Hibernate: create index ACT_IDX_HI_DETAIL_TASK_ID on ACT_HI_DETAIL(TASK_ID_)
Hibernate: create index ACT_IDX_HI_PROCVAR_PROC_INST on ACT_HI_VARINST(PROC_INST_ID_)
Hibernate: create index ACT_IDX_HI_PROCVAR_NAME_TYPE on ACT_HI_VARINST(NAME_, VAR_TYPE_)
Hibernate: create index ACT_IDX_HI_ACT_INST_PROCINST on ACT_HI_ACTINST(PROC_INST_ID_, ACT_ID_)
Hibernate: create index ACT_IDX_HI_ACT_INST_EXEC on ACT_HI_ACTINST(EXECUTION_ID_, ACT_ID_)
Hibernate: create table ACT_ID_GROUP ( 
ID_ varchar(64), 
REV_ integer, 
NAME_ varchar(255), 
TYPE_ varchar(255), 
primary key (ID_) 
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin
Hibernate: create table ACT_ID_MEMBERSHIP ( 
USER_ID_ varchar(64), 
GROUP_ID_ varchar(64), 
primary key (USER_ID_, GROUP_ID_) 
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin
Hibernate: create table ACT_ID_USER ( 
ID_ varchar(64), 
REV_ integer, 
FIRST_ varchar(255), 
LAST_ varchar(255), 
EMAIL_ varchar(255), 
PWD_ varchar(255), 
PICTURE_ID_ varchar(64), 
primary key (ID_) 
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin
Hibernate: create table ACT_ID_INFO ( 
ID_ varchar(64), 
REV_ integer, 
USER_ID_ varchar(64), 
TYPE_ varchar(64), 
KEY_ varchar(255), 
VALUE_ varchar(255), 
PASSWORD_ LONGBLOB, 
PARENT_ID_ varchar(255), 
primary key (ID_) 
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin
Hibernate: alter table ACT_ID_MEMBERSHIP 
add constraint ACT_FK_MEMB_GROUP 
foreign key (GROUP_ID_) 
references ACT_ID_GROUP (ID_)
Hibernate: alter table ACT_ID_MEMBERSHIP 
add constraint ACT_FK_MEMB_USER 
foreign key (USER_ID_) 
references ACT_ID_USER (ID_)
Hibernate: select * from ACT_RE_DEPLOYMENT D where NAME_=? order by D.DEPLOY_TIME_ desc
Hibernate: select * from ACT_GE_PROPERTY where NAME_ = ?
Hibernate: update ACT_GE_PROPERTY
     SET REV_ = ?,
      VALUE_ = ? 
    where NAME_ = ?
      and REV_ = ?
Hibernate: select *
    from ACT_RE_PROCDEF 
    where KEY_ = ? and
          VERSION_ = (select max(VERSION_) from ACT_RE_PROCDEF where KEY_ = ?)
Hibernate: select * from ACT_RU_JOB
      where HANDLER_TYPE_ = ?
      and HANDLER_CFG_ =  ?
Hibernate: insert into ACT_RE_DEPLOYMENT(ID_, NAME_, CATEGORY_, DEPLOY_TIME_)
    values(?, ?, ?, ?)
Hibernate: insert into ACT_GE_BYTEARRAY(ID_, REV_, NAME_, BYTES_, DEPLOYMENT_ID_, GENERATED_)
    values (?, 1, ?, ?, ?, ?)
Hibernate: insert into ACT_GE_BYTEARRAY(ID_, REV_, NAME_, BYTES_, DEPLOYMENT_ID_, GENERATED_)
    values (?, 1, ?, ?, ?, ?)
Hibernate: insert into ACT_RE_PROCDEF(ID_, REV_, CATEGORY_, NAME_, KEY_, VERSION_, DEPLOYMENT_ID_, RESOURCE_NAME_, DGRM_RESOURCE_NAME_, DESCRIPTION_, HAS_START_FORM_KEY_, SUSPENSION_STATE_)
    values (?,
    		1,
            ?,
            ?,
            ?, 
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?)
Hibernate: select *
    from ACT_RE_PROCDEF 
    where KEY_ = ? and
          VERSION_ = (select max(VERSION_) from ACT_RE_PROCDEF where KEY_ = ?)
Hibernate: insert into ACT_RU_EXECUTION (ID_, REV_, PROC_INST_ID_, BUSINESS_KEY_, PROC_DEF_ID_, ACT_ID_, IS_ACTIVE_, IS_CONCURRENT_, IS_SCOPE_,IS_EVENT_SCOPE_, PARENT_ID_, SUPER_EXEC_, SUSPENSION_STATE_, CACHED_ENT_STATE_)
    values (
      ?,
      1,
      ?,
      ?,
      ?,
      ?,
      ?,
      ?,
      ?,
      ?,
      ?,
      ?,
      ?,
      ?
    )
Hibernate: insert into ACT_HI_PROCINST (
        ID_,
        PROC_INST_ID_,
        BUSINESS_KEY_,
        PROC_DEF_ID_,
        START_TIME_,
        END_TIME_,
        DURATION_,
        START_USER_ID_,
        START_ACT_ID_,
        END_ACT_ID_,
        SUPER_PROCESS_INSTANCE_ID_,
        DELETE_REASON_
      ) values (
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?
      )
Hibernate: insert into ACT_HI_ACTINST (
        ID_,
        PROC_DEF_ID_,
        PROC_INST_ID_,
        EXECUTION_ID_,
        ACT_ID_,
        TASK_ID_,
        CALL_PROC_INST_ID_,
        ACT_NAME_,
        ACT_TYPE_,
        ASSIGNEE_,
        START_TIME_,
        END_TIME_,
        DURATION_
      ) values (
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?
      )
Hibernate: insert into ACT_RU_VARIABLE (ID_, REV_, TYPE_, NAME_, PROC_INST_ID_, EXECUTION_ID_, TASK_ID_, BYTEARRAY_ID_, DOUBLE_, LONG_ , TEXT_, TEXT2_)
    values (
	    ?,
	    1,
	    ?,
	    ?,
      ?,
	    ?,
      ?,
	    ?,
	    ?,
	    ?,
	    ?,
	    ?
    )
Hibernate: insert into ACT_HI_VARINST (ID_, PROC_INST_ID_, EXECUTION_ID_, TASK_ID_, NAME_, REV_, VAR_TYPE_, BYTEARRAY_ID_, DOUBLE_, LONG_ , TEXT_, TEXT2_)
    values (
      ?,
      ?,
      ?,
      ?,
      ?,
      ?,
      ?,
      ?,
      ?,
      ?,
      ?,
      ?
    )
Hibernate: insert into ACT_HI_ACTINST (
        ID_,
        PROC_DEF_ID_,
        PROC_INST_ID_,
        EXECUTION_ID_,
        ACT_ID_,
        TASK_ID_,
        CALL_PROC_INST_ID_,
        ACT_NAME_,
        ACT_TYPE_,
        ASSIGNEE_,
        START_TIME_,
        END_TIME_,
        DURATION_
      ) values (
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?
      )
Hibernate: insert into ACT_RU_TASK (ID_, REV_, NAME_, PARENT_TASK_ID_, DESCRIPTION_, PRIORITY_, CREATE_TIME_, OWNER_,
                      ASSIGNEE_, DELEGATION_, EXECUTION_ID_, PROC_INST_ID_, PROC_DEF_ID_, TASK_DEF_KEY_, DUE_DATE_, SUSPENSION_STATE_)
    values (?,
            1,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?
           )
Hibernate: insert into ACT_HI_TASKINST (
        ID_,
        PROC_DEF_ID_,
        PROC_INST_ID_,
        EXECUTION_ID_,
        NAME_,
        PARENT_TASK_ID_,
        DESCRIPTION_,
        OWNER_,
        ASSIGNEE_,
        START_TIME_,
        CLAIM_TIME_,
        END_TIME_,
        DURATION_,
        DELETE_REASON_,
        TASK_DEF_KEY_,
        FORM_KEY_,
        PRIORITY_,
        DUE_DATE_
      ) values (
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?
      )
id 5 HumanAndServiceTaskExample:1:4
Hibernate: select distinct RES.* 
       
    from ACT_RU_TASK RES
     
     
     
      inner join ACT_RE_PROCDEF D on RES.PROC_DEF_ID_ = D.ID_
     
     
     WHERE  RES.TASK_DEF_KEY_ = ?
      
      
      
      
        and D.KEY_ = ? 
    
     order by RES.ID_ asc 
    LIMIT ? OFFSET ?
Hibernate: select * from ACT_RU_TASK where ID_ = ?
Hibernate: select * from ACT_HI_TASKINST where ID_ = ?
Hibernate: select * from ACT_RU_EXECUTION where ID_ = ?
Hibernate: select * from ACT_RU_IDENTITYLINK where PROC_INST_ID_ = ?
Hibernate: select * from ACT_RE_PROCDEF where ID_ = ?
Hibernate: select RES.* 
     
    from ACT_HI_ACTINST RES
     WHERE  RES.EXECUTION_ID_ = ?
      
      
      
        and RES.ACT_ID_ = ?
      
      
      
      
      
        and RES.END_TIME_ is null 
   
     order by RES.ID_ asc 
    LIMIT ? OFFSET ?
Hibernate: insert into ACT_RU_IDENTITYLINK (ID_, REV_, TYPE_, USER_ID_, GROUP_ID_, TASK_ID_, PROC_INST_ID_, PROC_DEF_ID_)
    values (?,
            1,
            ?,
            ?,
            ?,
            ?,
            ?,
            ?)
Hibernate: update ACT_RU_TASK
     SET REV_ = ?,
      NAME_ = ?,
      PARENT_TASK_ID_ = ?,
      PRIORITY_ = ?,
      CREATE_TIME_ = ?,
      OWNER_ = ?,
      ASSIGNEE_ = ?,
      DELEGATION_ = ?,
      EXECUTION_ID_ = ?,
      PROC_DEF_ID_ = ?,
      DESCRIPTION_ = ?,
      DUE_DATE_ = ?,
      SUSPENSION_STATE_ = ? 
    where ID_= ?
      and REV_ = ?
Hibernate: update ACT_HI_TASKINST set
      EXECUTION_ID_ = ?,
      NAME_ = ?,
      PARENT_TASK_ID_ = ?,
      DESCRIPTION_ = ?,
      OWNER_ = ?,
      ASSIGNEE_ = ?,
      CLAIM_TIME_ = ?,
      END_TIME_ = ?,
      DURATION_ = ?,
      DELETE_REASON_ = ?,
      TASK_DEF_KEY_ = ?,
      FORM_KEY_ = ?,
      PRIORITY_ = ?,
      DUE_DATE_ = ?
    where ID_ = ?
Hibernate: update ACT_HI_ACTINST set
      EXECUTION_ID_ = ?,
      ASSIGNEE_ = ?,
      END_TIME_ = ?,
      DURATION_ = ?
    where ID_ = ?
Hibernate: select * from ACT_RU_TASK where ID_ = ?
Hibernate: select * from ACT_RU_EXECUTION where ID_ = ?
Hibernate: select * from ACT_RU_VARIABLE 
		where EXECUTION_ID_ = ?
		  and TASK_ID_ is null
Hibernate: select * from ACT_RE_PROCDEF where ID_ = ?
Hibernate: select * from ACT_RU_TASK where PARENT_TASK_ID_ = ?
Hibernate: select * from ACT_RU_IDENTITYLINK where TASK_ID_ = ?
Hibernate: select * from ACT_RU_VARIABLE where
    TASK_ID_ = ?
Hibernate: select * from ACT_HI_TASKINST where ID_ = ?
Hibernate: select distinct T.*
    from ACT_RU_TASK T
    where T.EXECUTION_ID_ = ?
Hibernate: select RES.* 
     
    from ACT_HI_ACTINST RES
     WHERE  RES.EXECUTION_ID_ = ?
      
      
      
        and RES.ACT_ID_ = ?
      
      
      
      
      
        and RES.END_TIME_ is null 
   
     order by RES.ID_ asc 
    LIMIT ? OFFSET ?
Executed process with key null with process definition Id HumanAndServiceTaskExample:1:4 with process instance Id 5 and current task name is Service Task
Hibernate: select * from ACT_HI_PROCINST where PROC_INST_ID_ = ?
Hibernate: select * from ACT_HI_VARINST where ID_ = ?
Hibernate: select * from ACT_RU_EXECUTION
    where PARENT_ID_ = ?
Hibernate: select * from ACT_RU_IDENTITYLINK where PROC_INST_ID_ = ?
Hibernate: insert into ACT_HI_VARINST (ID_, PROC_INST_ID_, EXECUTION_ID_, TASK_ID_, NAME_, REV_, VAR_TYPE_, BYTEARRAY_ID_, DOUBLE_, LONG_ , TEXT_, TEXT2_)
    values (
      ?,
      ?,
      ?,
      ?,
      ?,
      ?,
      ?,
      ?,
      ?,
      ?,
      ?,
      ?
    )
Hibernate: insert into ACT_HI_ACTINST (
        ID_,
        PROC_DEF_ID_,
        PROC_INST_ID_,
        EXECUTION_ID_,
        ACT_ID_,
        TASK_ID_,
        CALL_PROC_INST_ID_,
        ACT_NAME_,
        ACT_TYPE_,
        ASSIGNEE_,
        START_TIME_,
        END_TIME_,
        DURATION_
      ) values (
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?
      )
Hibernate: insert into ACT_HI_ACTINST (
        ID_,
        PROC_DEF_ID_,
        PROC_INST_ID_,
        EXECUTION_ID_,
        ACT_ID_,
        TASK_ID_,
        CALL_PROC_INST_ID_,
        ACT_NAME_,
        ACT_TYPE_,
        ASSIGNEE_,
        START_TIME_,
        END_TIME_,
        DURATION_
      ) values (
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?
      )
Hibernate: update ACT_HI_TASKINST set
      EXECUTION_ID_ = ?,
      NAME_ = ?,
      PARENT_TASK_ID_ = ?,
      DESCRIPTION_ = ?,
      OWNER_ = ?,
      ASSIGNEE_ = ?,
      CLAIM_TIME_ = ?,
      END_TIME_ = ?,
      DURATION_ = ?,
      DELETE_REASON_ = ?,
      TASK_DEF_KEY_ = ?,
      FORM_KEY_ = ?,
      PRIORITY_ = ?,
      DUE_DATE_ = ?
    where ID_ = ?
Hibernate: update ACT_HI_PROCINST set
      PROC_DEF_ID_ = ?,
      START_TIME_ = ?,
      END_TIME_ = ?,
      DURATION_ = ?,
      END_ACT_ID_ = ?,
      DELETE_REASON_ = ?
    where ID_ = ?
Hibernate: update ACT_HI_ACTINST set
      EXECUTION_ID_ = ?,
      ASSIGNEE_ = ?,
      END_TIME_ = ?,
      DURATION_ = ?
    where ID_ = ?
Hibernate: delete from ACT_RU_TASK where ID_ = ? and REV_ = ?
Hibernate: delete from ACT_RU_VARIABLE where ID_ = ? and REV_ = ?
Hibernate: delete from ACT_RU_IDENTITYLINK where ID_ = ?
Hibernate: delete from ACT_RU_EXECUTION where ID_ = ? and REV_ = ?

Share this:

  • Click to share on Twitter (Opens in new window)
  • Click to share on Facebook (Opens in new window)
  • Click to share on Google+ (Opens in new window)

Related

Did you like this article? Share it with your friends!

Tweet

Written by Dhananjay Jha

I am a java professional working with a software firm in Noida as "Manager - Product Engineering". I am always keen to learn and share what I have learnt. More professional details about me are available at Linked In and social details are available at facebook and Google Plus. I share my thought in maithili (my mother tongue) at बताह मैथिल and bataahmaithil

Follow me on Twitter
← Caused by: java.lang.ClassNotFoundException: org.springframework.beans.factory.NoUniqueBeanDefinitionException
JAX-WS web service on Tomcat →

6 Responses to "Setup and run first sample process using activiti"

  1. Rohit says:
    August 21, 2015 at 8:03 pm

    I am facing below issue while running the same example . Only difference is I am using oracle db rather than sql:

    ### SQL: select * from ACT_RE_DEPLOYMENT D where NAME_=? order by D.DEPLOY_TIME_ desc
    ### Cause: org.apache.ibatis.type.TypeException: Error setting null for parameter #1 with JdbcType OTHER . Try setting a different JdbcType for this parameter or a different jdbcTypeForNull configuration property. Cause: java.sql.SQLException: Invalid column type: 1111
    at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:23) ~[mybatis-3.2.5.jar:3.2.5]
    at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:107) ~[mybatis-3.2.5.jar:3.2.5]
    ………..
    ………..
    Caused by: org.apache.ibatis.type.TypeException: Error setting null for parameter #1 with JdbcType OTHER . Try setting a different JdbcType for this parameter or a different jdbcTypeForNull configuration property. Cause: java.sql.SQLException: Invalid column type: 1111
    ………..
    ………..
    Caused by: java.sql.SQLException: Invalid column type: 1111

    Reply
    1. Vinay says:
      April 27, 2017 at 9:45 pm

      Hi Rohit,

      Were you able to resolve this error ever? I am facing the same error and am stuck.

      Reply
  2. Asif says:
    October 21, 2015 at 9:35 am

    Hi Rohit,
    I was using sql server 2008 even i face the same issue,the problem is the sqljdbc.jar version .
    I was using sqljdbc1.2.jar and i upgraded to sqljdbc4-4.0.jar .
    Now its working fine .

    Check the jar version compatibility that you are using.

    Reply
  3. Gourahari Sendha says:
    May 20, 2016 at 9:36 pm

    Hi Guys,
    I am new to Acitiviti BPM. I am trying to to Deploy my BPM into explorer .It is showing class not found Exception by BPM Engine.

    In BPM diagram, I am using a simple STARTEVENT-SERVICETASK-ENDEVENT.

    Any one could you please send a simple BPM using Service task project to me ,it will great help.

    Thanks in Advance.

    Reply
    1. Dhananjay Jha says:
      May 29, 2016 at 10:00 pm

      Hello Gourhari,

      If you just remove first human task after start event – given example will serve your purpose.

      Regards
      Dhananjay Jha

      Reply
  4. Anuradha says:
    April 19, 2017 at 6:28 pm

    Hi Sir,
    Could you tell me, what is the purpose of using JobExecutor and AsyncExecutor with Activiti.

    Reply

Leave a Reply Cancel reply

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

Authors

  • Dhananjay Jha
  • Manish Kumar
  • Sushil Pandey

Recent Comments

  • muhammad on Mail merge in java for Microsoft Word document – Part I
  • muhammad on Mail merge in java for Microsoft Word document – Part I
  • Dhananjay Jha on Mail merge in java for Microsoft Word document and convert to PDF without iText – Part II
  • Clyde Symonette on Mail merge in java for Microsoft Word document and convert to PDF without iText – Part II
  • Dhananjay Kumar Jha on Mail merge in java for Microsoft Word document and convert to PDF without iText – Part II

Tag Cloud

.net activiti activiti-spring activiti bpmn C# change sender mail id in wordpress class classloader Conver MS Word to PDF disable user wordpress dox4j glassfish http response compression java Java Mail Merge MS Word javascript confirmation link on image jax-ws on tomcat jax-ws webservice Jee JTS junit junit-spring Link on Image with hidden URL link load spring configuration load spring configuration xml junit maven maven build Merge MS Word using Java Merge Word Document using XdocReport OOPS oracle weblogic PDF conversion using docx4j php mail function sample activiti process with human task and service task sending mail with attachment spring-orm spring framework spring hibernate spring hibernate integration spring jpa spring jpa hibernate integration tomcat jax-ws web service wordpress wordpress sender email

Looking for old post?

© 2021 Sambhashanam