Hi!
in our application, we create a new BpmnModelInstance in a ServiceTask via a JavaDelegate, which we then want to deploy and start using the RepositoryService.
So inside the execution method of the Delegate we have something like:
BpmnModelInstance modelInstance = ...;
Path tempFile = Files.createTempFile("bpmn-test", ".bpmn");
Bpmn.writeModelToFile(tempFile.toFile(), modelInstance);
RepositoryService repositoryService =
execution.getProcessEngineServices().getRepositoryService();
Deployment deployment = repositoryService
.createDeployment()
.addModelInstance("NewProcess.bpmn", modelInstance).deploy();
final ProcessDefinition processDefinition = repositoryService
.createProcessDefinitionQuery()
.deploymentId(deployment.getId()).singleResult();
Here, the returned processDefinition is null. There is however no visible error that occurs during the deployment. Is there a problem with deploying a new Process from a Java Delegate?
If we run the code in a seperate UnitTest
BpmnModelInstance modelInstance = ...;
Path tempFile = Files.createTempFile("bpmn-test", ".bpmn");
Bpmn.writeModelToFile(tempFile.toFile(), modelInstance);
final ProcessEngine engine = ProcessEngineConfiguration
.createStandaloneInMemProcessEngineConfiguration()
.setJobExecutorActivate(true).buildProcessEngine();
final Deployment deployment = engine.getRepositoryService()
.createDeployment()
.addModelInstance("NewProcess.bpmn", modelInstance)
.deploy();
final ProcessDefinition processDefinition = engine
.getRepositoryService().createProcessDefinitionQuery()
.deploymentId(deployment.getId()).singleResult();
we correctly retrieve the ProcessDefinition and can start it via the RuntimeService.
Do you have any ideas what causes this behavior?
Thanks and best regards,
Stephan