cancel
Showing results for 
Search instead for 
Did you mean: 

How to start a process?

kg86
Champ in-the-making
Champ in-the-making
Hi,
I created an activiti process in the eclipse designer. It's only one Script task with Syste.out.println("Hello"); .
Now I want to run this process. But I don't know how? Run as java class and run as java applet wasn't sucessfull.

What I have to do to run a created process?

Edit:
I have found a tutorial. So I tried this code:

public class RunProcess {

   public static void main(String [ ] args){
      //First, boot up the process engine:
      ProcessEngine processEngine = new DbProcessEngineBuilder().configureFromPropertiesResource("activiti.properties").buildProcessEngine();
      ProcessService processService = processEngine.getProcessService();
      
      //To run the process, it first need to be ‘deployed’ to the engine.
      //Deploying means that the process is parsed and stored in the Activiti database:
      processService.createDeployment().addClasspathResource("MyProcess.bpmn20.xml").deploy();
      
      //execute the process
      processService.startProcessInstanceByKey("MyProcess");
   }   
}

But there come an error:
'Editor does not contain a main type.'

Can someone find my mistake? Thanks a lot.

CU,
Kai
2 REPLIES 2

gant
Champ in-the-making
Champ in-the-making
Since you use the designer, the easiest way to only start a process instance is using a junit-test.

Right-click on your bpmn20.xml file and select Activiti "Generate Unit Test"
Now you will find a .java file in src/test/java run this file as a "JUnit test".

This is also described in the user guide

Regards,
michael

albasmith
Champ in-the-making
Champ in-the-making
check out this link 'JavaRanch FAQ HowToAskQuestionsOnJavaRanch' Basically i ma not able to find out any error in your code so you can try this link.