cancel
Showing results for 
Search instead for 
Did you mean: 

changes to run activiti 5.9 flows in java over 5.8 seeked

aparneshgaurav
Champ in-the-making
Champ in-the-making
Using the following code , i was able to run my activiti 5.8 version flows , now the process id and name of the flows are changed,
Now the error is shown the process with the given process id has not been deployed.Moreover , .bpmn files are generated for flows
instead of .activiti files. Please susggest changes to run activiti 5.9 over running flows in 5.8 .




// ProcessEngine processEngine = ProcessEngineConfiguration.createStandaloneInMemProcessEngineConfiguration().buildProcessEngine();
      ProcessEngine processEngine = ProcessEngineConfiguration.createStandaloneProcessEngineConfiguration().setJdbcUrl("jdbcSmiley Tongueostgresql://localhost:5432/postgres").setJdbcDriver("org.postgresql.Driver").setJdbcUsername("postgres").setJdbcPassword("postgres").setJobExecutorActivate(true).setDatabaseSchemaUpdate("true").buildProcessEngine();
      RepositoryService repositoryService = processEngine.getRepositoryService();
      // code to deploy the process
      repositoryService.createDeployment().addClasspathResource("diagrams/MyProcess.bpmn20.xml").deploy(); //DataBaseNodeTest , DataBaseQueryFetchAndForward , SchedulerNodeTest , FtpNodeTest ,
      RuntimeService   runtimeService = processEngine.getRuntimeService();
      // code to run the process instance
      ProcessInstance processInstance = runtimeService.startProcessInstanceById("MyProcess");



Thanks,
Aparnesh
8 REPLIES 8

frederikherema1
Star Contributor
Star Contributor
runtimeService.startProcessInstanceById("MyProcess");
-> this is wrong. You should use startProcessInstanceByKey("MyProcess"). The ID of the processDefinition is auto-generated. When using the byKey method, you always start the latest version of your process…

aparneshgaurav
Champ in-the-making
Champ in-the-making
Even after i used startProcessInstanceByKey , this is what i got , i have checked by deployment id that my processes are getting deployed correctly. And thanks a lot for replying . If you could suggest anything more.
______________________________
org.activiti.engine.ActivitiException: no processes deployed with key 'MyProcess'
at org.activiti.engine.impl.persistence.deploy.DeploymentCache.findDeployedLatestProcessDefinitionByKey(DeploymentCache.java:62)
__________________________________

Following is the .bpmn file converted by me to .bpmn20.xml as suggested by guide.

____________________________________

<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:activiti="http://activiti.org/bpmn" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlnsSmiley Surprisedmgdc="http://www.omg.org/spec/DD/20100524/DC" xmlnsSmiley Surprisedmgdi="http://www.omg.org/spec/DD/20100524/DI" typeLanguage="http://www.w3.org/2001/XMLSchema" expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://www.activiti.org/test">
  <process id="process1" name="process1">
    <startEvent id="startevent1" name="Start"></startEvent>
    <serviceTask id="servicetask1" name="Service Task" activiti:class="checkpackage.ActivitiClass"></serviceTask>
    <endEvent id="endevent1" name="End"></endEvent>
    <sequenceFlow id="flow1" name="" sourceRef="servicetask1" targetRef="endevent1"></sequenceFlow>
    <sequenceFlow id="flow2" name="" sourceRef="startevent1" targetRef="servicetask1"></sequenceFlow>
  </process>
  <bpmndi:BPMNDiagram id="BPMNDiagram_process1">
    <bpmndi:BPMNPlane bpmnElement="process1" id="BPMNPlane_process1">
      <bpmndi:BPMNShape bpmnElement="startevent1" id="BPMNShape_startevent1">
        <omgdc:Bounds height="35" width="35" x="190" y="80"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="servicetask1" id="BPMNShape_servicetask1">
        <omgdc:Bounds height="55" width="105" x="340" y="70"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="endevent1" id="BPMNShape_endevent1">
        <omgdc:Bounds height="35" width="35" x="500" y="80"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNEdge bpmnElement="flow1" id="BPMNEdge_flow1">
        <omgdi:waypoint x="445" y="97"></omgdi:waypoint>
        <omgdi:waypoint x="500" y="97"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow2" id="BPMNEdge_flow2">
        <omgdi:waypoint x="225" y="97"></omgdi:waypoint>
        <omgdi:waypoint x="340" y="97"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
    </bpmndi:BPMNPlane>
  </bpmndi:BPMNDiagram>
</definitions>

___________________________________________________-

Following is the java code to execute the xml flow

__________________________

// ProcessEngine processEngine = ProcessEngineConfiguration.createStandaloneInMemProcessEngineConfiguration().buildProcessEngine();
  ProcessEngine processEngine = ProcessEngineConfiguration.createStandaloneProcessEngineConfiguration().setJdbcUrl("jdbcSmiley Tongueostgresql://localhost:5432/postgres").setJdbcDriver("org.postgresql.Driver").setJdbcUsername("postgres").setJdbcPassword("postgres").setJobExecutorActivate(true).setDatabaseSchemaUpdate("true").buildProcessEngine();
  RepositoryService repositoryService = processEngine.getRepositoryService();
  // code to deploy the process
  repositoryService.createDeployment().addClasspathResource("diagrams/MyProcess.bpmn20.xml").deploy(); //DataBaseNodeTest , DataBaseQueryFetchAndForward , SchedulerNodeTest , FtpNodeTest ,
  RuntimeService runtimeService = processEngine.getRuntimeService();
  // code to run the process instance
  ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("MyProcess"); //AccountSummarWithPdfInRAndHtml

___________________________


Thanks,
Aparnesh

aparneshgaurav
Champ in-the-making
Champ in-the-making
Also as you can see the xml generated for the flow has process id as "process1" , so i used startProcessByKey or Id using "process1" , this also could not help . Also if you could tell me a guide which shows to execute activiti 5.9 flows.

Thanks.

frederikherema1
Star Contributor
Star Contributor
You shouldn't "generate" or convert the activiti files. You should right-click on your activiti-project in eclipse (with designer plugin) and say "generate deployment resources". Unpack the zip/bar in the deployment-folder and extract the bpmn-file you need.

If the properties-pane in Activiti Designer for the process you designed says "process1", this is the key you should use when starting a process (using startProcessByKey)

aparneshgaurav
Champ in-the-making
Champ in-the-making
Thanks , checking that out.

aparneshgaurav
Champ in-the-making
Champ in-the-making
How to extract form .bpmn file from the .bar file in windows , which software to use ?

Aparnesh

frederikherema1
Star Contributor
Star Contributor
It would really help if you read the manual BEFORE asking questions on the forum:

http://activiti.org/userguide/index.html#N106B5
To deploy processes, they have to be wrapped in a business archive. A business archive is the unit of deployment to an Activiti Engine. Basically a business archive is equivalent to a zip file. It can contain BPMN 2.0 processes, task forms, rules and any other type of file. In general, a business archive contains a collection of named resources.

It's a zip-file… rename to zip or open with favorite archiving software

aparneshgaurav
Champ in-the-making
Champ in-the-making
Thanks loads , ***************relief********************* , after creating multiple technology nodes , was little nervous why not able to migrate to 5.9 , thanks a lot dude specially for your quick responses.

Best Regards,
Aparnesh Gaurav