AnsweredAssumed Answered

Some questions regarding Activiti

Question asked by d.y. on Nov 16, 2011
Latest reply on Nov 16, 2011 by d.y.
Hey guys,

I'm trying to get a simple web app running but I'm kinda stuck at first steps.

I created a "new Activiti Project" in eclipse and converted it to a maven project so far so good. When I try to run the "TenMinuteTutorial" example:


import java.util.List;

import org.activiti.engine.HistoryService;
import org.activiti.engine.ProcessEngine;
import org.activiti.engine.ProcessEngineConfiguration;
import org.activiti.engine.RepositoryService;
import org.activiti.engine.RuntimeService;
import org.activiti.engine.TaskService;
import org.activiti.engine.history.HistoricProcessInstance;
import org.activiti.engine.task.Task;

public class TenMinuteTutorial {

   public static void main(String[] args) {

      // Create Activiti process engine
      ProcessEngine processEngine = ProcessEngineConfiguration.createStandaloneProcessEngineConfiguration().buildProcessEngine();

      // Get Activiti services
      RepositoryService repositoryService = processEngine.getRepositoryService();
      RuntimeService runtimeService = processEngine.getRuntimeService();

      // Deploy the process definition

      // Start a process instance
      String procId = runtimeService.startProcessInstanceByKey("financialReport").getId();

      // Get the first task
      TaskService taskService = processEngine.getTaskService();
      List<Task> tasks = taskService.createTaskQuery().taskCandidateGroup("accountancy").list();
      for (Task task : tasks) {
         System.out.println("Following task is available for accountancy group: " + task.getName());

         // claim it
         taskService.claim(task.getId(), "fozzie");

      // Verify Fozzie can now retrieve the task
      tasks = taskService.createTaskQuery().taskAssignee("fozzie").list();
      for (Task task : tasks) {
         System.out.println("Task for fozzie: " + task.getName());

         // Complete the task

      System.out.println("Number of tasks for fozzie: " + taskService.createTaskQuery().taskAssignee("fozzie").count());

      // Retrieve and claim the second task
      tasks = taskService.createTaskQuery().taskCandidateGroup("management").list();
      for (Task task : tasks) {
         System.out.println("Following task is available for accountancy group: " + task.getName());
         taskService.claim(task.getId(), "kermit");

      // Completing the second task ends the process
      for (Task task : tasks) {

      // verify that the process is actually finished
      HistoryService historyService = processEngine.getHistoryService();
      HistoricProcessInstance historicProcessInstance = historyService.createHistoricProcessInstanceQuery().processInstanceId(procId).singleResult();
      System.out.println("Process instance end time: " + historicProcessInstance.getEndTime());


I get an "org.activiti.engine.ActivitiException": no activiti tables in db.  set <property name="databaseSchemaUpdate" to value="true" or value="create-drop" (use create-drop for testing only!) in bean processEngineConfiguration in activiti.cfg.xml for automatic schema creation

So it seems like I need the "activiti.cfg.xml" from the examples. I copied it to src/main/resources/ (and also to src/main/config/) but I still get the same error. If this file is needed for an "Activiti Project" it would be nice if it would be created automatically when creating an "Activiti Project". Nevertheless, what am I doing wrong here? Where do I have to put this file or am I missing something else?

Thank you in advance.