I am trying to implement a project involving several web services using a shared camunda process engine.
I have worked through the spring example (Get started with Camunda and the Spring Framework | docs.camunda.org) and now want to access my process engine from a CXF web service. Everything is being deployed on a vanilla tomcat 8.0.32.
The engine itself (Maven → .war file) is deploying without errors and the log reassuringly says “ENGINE-00001 Process Engine default created.”
The web service (also deployed as a .war), however, causes an error during deployment:
SEVERE [localhost-startStop-3] org.springframework.web.context.ContextLoader.initWebApplicationContext Context initialization failed
org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [org.camunda.bpm.BpmPlatform] for bean with name ‘processEngineService’ defined in ServletContext resource [/WEB-INF/applicationContext.xml]; nested exception is java.lang.ClassNotFoundException: org.camunda.bpm.BpmPlatform
The web service pom.xml declares the camunda-engine as “provided”, following the tutorial.
The only camunda-related jar ending up in the web-service .war is “camunda-engine-spring.7.4.0.jar”.
Inside the web service applicationContext.xml, the corresponding bean is defined as
(xml tags ommitted here). As this is my first spring project and I don’t yet fully understand how the resolving in the background is happening exactly, I would appreciate it very much if someone could point me into the right direction here.
Do you use the standalone webapp from here? Then you cannot use the shared process engine approach. Please download the pre-packaged Camunda Tomcat distribution from here or read up here on how to manually install the Camunda BPM platform into your vanilla Tomcat.
I am using a vanilla tomcat for deployment of both my shared engine and my web service.
Do I understand you correctly and you suggest to deploy them both on the camunda tomcat?
No, you just deploy the web service on the Camunda Tomcat. It brings a preconfigured shared engine with it. The standalone webapp is not a shared process engine, it uses an embedded engine. More on that, see here.
Hmm. I am confused.
So I completely misunderstood and the tutorial I linked to in my original post was never intended to work with its “own” shared engine?
Yes, you are right. I just read the text and it doesn’t explicitly states that you have to use a Camunda BPM distribution with a bundled shared process engine.
Basically when you want to use a shared process engine, either download a Camunda distribution or install the Platform manually like I wrote above.
The standalone webapp is just meant to be used when you want to run a simple process application using an embedded engine. You can use it together with a Maven WAR overlay to include your sources to deploy it anywhere, because it is self-contained.
thank you very much for the insight and the help! I got everything working now: I deployed the web service on the camunda tomcat and can launch camunda processes from the “outside”.