Activiti Note

1. Install Activiti Eclipse Plugin

Noteworthy URL:


2. java.lang.NumberFormatException when using Activiti Explorer

Seems Firefox friendly, no NumberFormatException so far on Firefox.

3. Attach Source in Eclipse

STEP 1: Download activiti source zip from git via HTTP, not have to install GIT client


STEP 2: Attach the downloaded source zip file in Eclipse directly

4. @BusinessProcessScoped

Spring's custom scope? No, it's for JEE6's CDI(Context Dependency Injection), Nice case!

5. Form Key

6. CDI & JSF

The Activiti CDI module enables you to use the Activiti API and process variables directly from a JSF page. This makes it easy to develop custom task list applications and even full process applications yourself.

7. Embedded (inline) and standalone subprocesses

A standalone subprocess is a business process that can also be used as a main process when this is applicable.

8. Vaadin

9. Parallel gateways

Parallel gateways aren’t hard to implement in a BPMN 2.0 process definition. But the runtime behavior is more difficult to grasp. As you’ll discover, the different outgoing sequence flows aren’t really executed in parallel but are still running one after another.

10. Note that a historic process instance is stored right away when a new process instance is started.

11. Logging

Activiti uses the standard Java java.util.logging API, also known as JDK 1.4 logging, and Spring uses Apache commons logging. This means that, by default, it’s not possible to have one logging configuration file. Luckily, there’s the Simple Logging Facade for Java (SLF4J— framework that can translate log messages from different frameworks into the log message of your choice.

12. Deployment

To deploy business archives on the Activiti Engine, you have three options. Deployments can be done via Java using the RepositoryService, using an Ant target, or—the easiest option—using Activiti Explorer.

13. The BPM life cycle shows that implementing business processes is an ongoing process due to the everchanging business environment and need for optimization.

14. ERROR: org.activiti.engine.impl.javax.el.PropertyNotFoundException: Could not find property title in class java.lang.String

15. LESSON: org.activiti.engine.ActivitiException: Error while evalutaing expression

I encountered this error in a service task.

Caused by: I passed a BookOrder instance into processVariable Map, as below:

	public void testCreateBookOrder() {
		Map<String, Object> processVariables = new HashMap<String, Object>();
		BookOrder order = new BookOrder();
		processVariables.put("order", order);
		runtimeService.startProcessInstanceByKey("bookOrder", processVariables);
		//formService.submitStartFormData("bookOrder", processVariables);
		BookOrder result = (BookOrder) entityManager.createQuery(
				"from BookOrder b").getSingleResult();
You can ONLY add String object into processVariable Map.
The following snippet works:

	public void testCreateBookOrderByIsbn() {
		Map<String, Object> processVariables = new HashMap<String, Object>();
		String isbn = "tuple";
		processVariables.put("isbn", isbn);
		runtimeService.startProcessInstanceByKey("bookOrder", processVariables);
		BookOrder result = (BookOrder) entityManager.createQuery(
				"from BookOrder b").getSingleResult();
And I strongly recomend you that refer to Activiti User Guide for how to configure ServiceTask, my local path is:


There are 4 ways of declaring how to invoke Java logic:
    -Specifying a class that implements JavaDelegate or ActivityBehavior
    -Evaluating an expression that resolves to a delegation object
    -Invoking a method expression
    -Evaluating a value expression

Follow up: When you use a Java bean as a process variable, make sure the bean implements the Serializable interface because the process variable will be persisted to the Activiti Engine database.

For activiti:resultVariableName, we may use a serializable java bean, but seems java bean doesn't work in Map parameter as mentioned before, need further experiments.

The following snippet is from <Activiti in Action>, my question is how to access DelegateExecution elsewhere.

package com.derek.struts2.simple.domain;

public class CreateApplicationTask implements JavaDelegate {
	public void execute(DelegateExecution execution) {
		LoanApplication la = new LoanApplication();
		la.setCreditCheckOk((Boolean) execution.getVariable("creditCheckOk"));
		la.setCustomerName((String) execution.getVariable("name"));
		la.setIncome((Long) execution.getVariable("income"));
		la.setRequestedAmount((Long) execution.getVariable("loanAmount"));
		la.setEmailAddres((String) execution.getVariable("emailAddress"));
		execution.setVariable("loanApplication", la);

16. The TaskService provides a lot of functionality surrounding user tasks for the Activiti engine. You can, for example, use the TaskService to query the engine for specific tasks or to create a new standalone task for a specific user.

The most common functionalities of the TaskService that you'll be using are theclaimandcompletemethods. When a user task is created for a process instance, a person has to claim and complete the user task before the process instance proceeds to the next activity.Claiming a task means that the person who claims the task becomes the owner (assignee) of the task. It also means that the claimed task isn't available anymore for the other potential task owners to claim or complete it.

17. Need to be clarified:

Whether Claiming a task is necessary in HW flows? We always assign tasks to people, people get their tasks passively, rather than claim task positively.

18. In the process definition, a process variable can be configured whereby this user identifier will be available during process execution:

<startEvent id="startEvent" activiti:initiator="starter" />

19. When we define a service task with the async attribute set to true, the execution of the service task logic will be executed in a separate transaction and thread.

Reference 1: <Activiti in Action>

Reference 2: <Activiti User Guide>