AnsweredAssumed Answered

Running activiti engine standalone

Question asked by gouthr on Oct 29, 2014
Latest reply on Oct 29, 2014 by gouthr
Hi,

I was able to successfully deploy and run a simple process using the JUNIT framework for activiti. I am trying to create a standalone application to run the same. Please let me know what I am missing here. Thanks!

//Working JUNIT test case:

public class ProcessTestMyProcess {

   private String filename = "C:\\junoDataProtectionWsp\\DataProtectionWorkflow\\src\\" +
         "main\\resources\\diagrams\\DataProtectionWorkflow.bpmn";

   @Rule
   public ActivitiRule activitiRule = new ActivitiRule();

   @Test
   public void startProcess() throws Exception {
      try {
         RepositoryService repositoryService = activitiRule.getRepositoryService();
         repositoryService.createDeployment().addInputStream("dataProtectionProcess.bpmn20.xml",
               new FileInputStream(filename)).deploy();
         RuntimeService runtimeService = activitiRule.getRuntimeService();

         ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("dataProtectionProcess");
         assertNotNull(processInstance.getId());
         System.out.println("Test execution: id: " + processInstance.getId() + " "
         + processInstance.getProcessDefinitionId());
         
      } catch (Exception e) {
         System.out.println("Error: " + e.toString());
         e.printStackTrace();
      }
   }
}

// Standalone appliaction  - Error trying to deploy activiti engine
package org.activiti.designer.test;

import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.util.List;

import org.activiti.engine.ProcessEngine;
import org.activiti.engine.ProcessEngineConfiguration;
import org.activiti.engine.runtime.ProcessInstance;
import org.activiti.engine.task.Task;

public class StandaloneDemo {

   public static void main (String [] args) {
      try {
      ProcessEngine processEngine = ProcessEngineConfiguration.createStandaloneInMemProcessEngineConfiguration()
           .setDatabaseSchemaUpdate(ProcessEngineConfiguration.DB_SCHEMA_UPDATE_FALSE)
           .setJdbcUrl("jdbc:h2:mem:my-own-db;DB_CLOSE_DELAY=1000")
           .setDatabaseSchemaUpdate("create-drop")
           .setJobExecutorActivate(true)
           .buildProcessEngine();

      /* Deploy the xml file. */
      //
      processEngine.getRepositoryService().createDeployment().addInputStream("dataProtectionProcess.bpmn20.xml",
            new FileInputStream("C:\\junoDataProtectionWsp\\DataProtectionWorkflow\\src\\" +
                  "main\\resources\\diagrams\\DataProtectionWorkflow.bpmn")).deploy();

      /* Start the process by id. */
      ProcessInstance processInstance = processEngine.getRuntimeService().startProcessInstanceByKey("dataProtectionProcess");

      System.out.println("Test execution: id: " + processInstance.getId() + " "
      + processInstance.getProcessDefinitionId());
   
      } catch (Exception e) {
         e.printStackTrace();
      }

   }
}

Here's the error when I try running the standalone application:
"usage: java org.activiti.engine.impl.juel.Builder <expression string>"

Outcomes