[jboss-user] [jBPM Users] - Re: [jbpm 4.2] My first simple application doesn't work :(

saraswati.santanu do-not-reply at jboss.com
Sat Dec 5 05:18:02 EST 2009


Silver,
    the code you have written is wrong. It will not work that way. You need to create a Jpdl file first. You can use the Eclipse GPD for that. And then use the Jbpm API to create ProcessDefinition etc. There is no class called ProcessFactory in Jbpm4.

   Second point that you need to understand is that a ProcessDefinition can not be started, it is the ProecessInstance which should be started.

   Now assuming you have created a flow jpdl xml file, then your main class should look like this:


  | private static ProcessEngine processEngine;
  | 
  | private static RepositoryService repositoryService;
  | private static ExecutionService executionService;
  | 
  | static {
  | 	processEngine = Configuration.getProcessEngine();
  | 
  | 	repositoryService = processEngine.get(RepositoryService.class);
  | 	executionService = processEngine.getExecutionService();
  | }
  | 
  | /**
  |  * @param args
  |  */
  | public static void main(String[] args) {
  | 	//create new deployment object and ask it to deploy your flow
  |        String deploymentId = repositoryService.createDeployment().addResourceFromClasspath("sampleprocess.jpdl.xml").deploy();
  |         
  |        //now we query the process definition
  |        ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().deploymentId(deploymentId).uniqueResult();
  |         
  |        //start the process instance with the Id of the process definition
  |       ProcessInstance processInstance = executionService.startProcessInstanceById(processDefinition.getId());
  | }
  | 

View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4269124#4269124

Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4269124



More information about the jboss-user mailing list