I am trying to configure shared process engine for my new application running in Tomcat. The engine is started with bpm-platform.xml file placed in Tomcat conf folder.
The engine is starting successfully and I am able to see the below message in logs:
Camunda BPM platform sucessfully started at ‘Apache Tomcat/8.0.24’.
But then while trying to deploy the application on server,I get the following error.
16-Feb-2019 05:37:38.331 SEVERE [main] org.springframework.web.context.ContextLoader.initWebApplicationContext Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘repositoryService’ defined in ServletContext resource [/WEB-INF/applicationContext.xml]: factory-bean ‘processEngine’ returned null
Your pom.xml looks good.
Could you please share your applicationContext.xml and the initialization of repositoryService, I assume is in the Starter class of the exercise.
The repositoryService is not initialized in Starter and I assume that you’re using it in AllRunningProcessInstances so you just need to define it similar to runtimeService:
public class Starter implements InitializingBean {
@Autowired
private RuntimeService runtimeService;
@Autowired
private RepositoryService repositoryService;
//...
public void setRuntimeService(RuntimeService runtimeService) {
this.runtimeService = runtimeService;
}
public void setRepositoryService(RepositoryService repositoryService) {
this.repositoryService = repositoryService;
}
}
Thanks Yana,that’s a good point.I implemented the same but now I get a different error even though I implemented JavaDelegate for AllRunningProcessInstances service.
19-Feb-2019 08:49:12.327 SEVERE [ContainerBackgroundProcessor[StandardEngine[Catalina]]] org.springframework.web.context.ContextLoader.initWebApplicationContext Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘org.camunda.bpm.getstarted.loanapproval.Starter#0’ defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is org.camunda.bpm.engine.ProcessEngineException: Delegate expression {allRunningProcessInstances} did neither resolve to an implementation of interface org.camunda.bpm.engine.impl.pvm.delegate.ActivityBehavior nor interface org.camunda.bpm.engine.delegate.JavaDelegate
I followed all the correct steps but still getting same error.Your advice will be greatly appreciated.
19-Feb-2019 18:31:04.171 SEVERE [ContainerBackgroundProcessor[StandardEngine[Catalina]]] org.camunda.bpm.engine.impl.interceptor.CommandContext.close Error while closing command context
org.camunda.bpm.engine.ProcessEngineException: Delegate expression {allRunningProcessInstances} did neither resolve to an implementation of interface org.camunda.bpm.engine.impl.pvm.delegate.ActivityBehavior nor interface org.camunda.bpm.engine.delegate.JavaDelegate
public class AllRunningProcessInstances implements JavaDelegate {
public void execute(DelegateExecution execution) throws Exception {
System.out.println("AllRunningProcessInstances Bean invoked now");
// TODO Auto-generated method stub
// get process engine and services
ProcessEngine processEngine = BpmPlatform.getDefaultProcessEngine();
RuntimeService runtimeService = processEngine.getRuntimeService();
}
}
I get the error:
20-Feb-2019 11:35:31.139 SEVERE [main] org.camunda.bpm.engine.impl.interceptor.CommandContext.close Error while closing command context
java.lang.NullPointerException
at org.camunda.bpm.getstarted.loanapproval.AllRunningProcessInstances.execute(AllRunningProcessInstances.java:25)
so looks like,the “processEngine” variable is null.Am I missing any configuration.