As we transition to the new Hyland Community, some post links may be temporarily disrupted as we finalize redirects. We apologize for the inconvenience and are working to resolve this as quickly as possible. Details.
repositoryService.createDeployment().addInputStream(identifier, inputStream).deploy();
<br>String processIdentifier = "extraction";<br>ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();<br><br>// Load the original process definition from hard disk.<br>String processDefinition1 = FileUtils.readFileToString("processDefinition1.bpmn20.xml");<br><br>// deploy original process definition. The first problem occurs here since I can not be sure that the id attribute of the process element in "processDefinition1.bpmn20.xml" is equal to "processIdentifier".<br>repositoryService.createDeployment().addString(processIdentifier, processDefinition1).deploy();<br><br>// maybe run the process once.<br>RuntimeService runtimeService = processEngine.getRuntimeService();<br>runtimeService.startProcessInstanceByKey(processIdentifier);<br><br>// Load the changed process definition from hard disk.<br>String processDefinition2 = FileUtils.readFileToString("processDefinition2.bpmn20.xml");<br><br>// exchange the old process definition with the new one.<br>String deploymentIdentifier = repositoryService.createProcessDefinitionQuery().processDefinitionId(processIdentifier).list().get(0).getId();<br>repositoryService.deleteDeployment(deploymentIdentifier);<br>repositoryService.createDeployment().addString(processIdentifier,processDefinition2).deploy();<br><br>// now the changed process definition should run but I get: org.activiti.engine.ActivitiException: no processes deployed with key 'extraction'<br>runtimeService.startProcessInstanceByKey(processIdentifier);<br>