Unable to load class for custom process

Hi forum, we developed a custom process (“menu.planer.war”) and have problems deploying it to a server running tomcat using the standalone camunda war. The process works without problems in a freshly installed “pre-packaged” distribution with tomcat and camunda alfready configured.

The system is ubuntu 18.04, with tomcat 9.0.12 and OpenJDK 8. Vanilla camunda seems to work fine (deployed as a .war), and our custom process .war seems to load as well (see log at the end of this post).

However, if I use “start process” to create a custom process, camunda is not able to load our custom class:

Nov 04 11:22:50 slappt01 tomcat9[25273]: ENGINE-16004 Exception while closing command context: ENGINE-09008 Exception while instantiating cla
ss ‘net.cibex.menuplaner.delegates.StartInstancesDelegate’: ENGINE-09017 Cannot load class ‘net.cibex.menuplaner.delegates.StartInstancesDelegate’: net.cibex.menuplaner.delegates.StartInstancesDelegate Nov 04 11:22:50 slappt01 tomcat9[25273]: org.camunda.bpm.engine.ProcessEngineException: ENGINE-09008 Exception while instantiating class ‘net
.cibex.menuplaner.delegates.StartInstancesDelegate’: ENGINE-09017 Cannot load class ‘net.cibex.menuplaner.delegates.StartInstancesDelegate’: net.cibex.menuplaner.delegates.StartInstancesDelegate

While trying to narrow down this problem I used strace to find out where tomcat looks for the corresponding .class-File, and it does so in CATALINA_BASE/lib, CATALINA_HOME/lib, and under WEB-INF/classes of the camunda webapp itself. I guess this is to be expected as per the settings in catalina.properties.

However, the correct path for the .class-file in question would be here:
/var/lib/tomcat9/webapps/menu-planer/WEB-INF/classes/net/cibex/menuplaner/delegates/StartInstancesDelegate.class

Everything I see seems to go according to what I read in the tomcat classloader documentation. My question now is, what is done to the pre-packaged distribution so this setup with classes in different webapps is working?

Other things I checked:

  • tomcat security manager is not enabled on our system
  • file system permissions are ok
  • I compared a lot of configuration files between the pre-packaged distribution and our vanilla standalone version, but could not find anything helpful

Thanks in advance for any pointers.

Urban / cibex GmbH

Here is the relevant log excerpt from tomcat startup:

Nov 04 11:22:03 slappt01 tomcat9[25273]: Deploying web application archive [/var/lib/tomcat9/webapps/menu-planer.war]
Nov 04 11:22:07 slappt01 tomcat9[25273]: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger fo
r a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time a
nd JSP compilation time.
Nov 04 11:22:07 slappt01 tomcat9[25273]: ENGINE-07015 Detected @ProcessApplication class ‘net.cibex.menuplaner.CamundaBpmProcessApplication’
Nov 04 11:22:07 slappt01 tomcat9[25273]: ENGINE-08024 Found processes.xml file at file:/var/lib/tomcat9/webapps/menu-planer/WEB-INF/classes/M
ETA-INF/processes.xml
Nov 04 11:22:07 slappt01 tomcat9[25273]: ENGINE-08023 Deployment summary for process archive ‘hsj’:
Nov 04 11:22:07 slappt01 tomcat9[25273]: hsj-menuebestellung.bpmn
Nov 04 11:22:08 slappt01 tomcat9[25273]: ENGINE-07021 ProcessApplication ‘Menu App’ registered for DB deployments [e6408b91-e03c-11e9-a3bc-52
5400eb9247, d0bbc21e-e8f8-11e9-b81f-525400eb9247, 3af658ec-e8f7-11e9-9a40-525400eb9247]. Will execute process definitions
Nov 04 11:22:08 slappt01 tomcat9[25273]: P01[version: 1, id: P01:1:e65bdbc3-e03c-11e9-a3bc-525400eb9247]
Nov 04 11:22:08 slappt01 tomcat9[25273]: Process_17jlk1w[version: 1, id: Process_17jlk1w:1:e65ced34-e03c-11e9-a3bc-525400eb9247]
Nov 04 11:22:08 slappt01 tomcat9[25273]: P01[version: 3, id: P01:3:d0d45330-e8f8-11e9-b81f-525400eb9247]
Nov 04 11:22:08 slappt01 tomcat9[25273]: Process_17jlk1w[version: 3, id: Process_17jlk1w:3:d0d6eb41-e8f8-11e9-b81f-525400eb9247]
Nov 04 11:22:08 slappt01 tomcat9[25273]: P01[version: 2, id: P01:2:3b13a4ee-e8f7-11e9-9a40-525400eb9247]
Nov 04 11:22:08 slappt01 tomcat9[25273]: Process_17jlk1w[version: 2, id: Process_17jlk1w:2:3b152b8f-e8f7-11e9-9a40-525400eb9247]
Nov 04 11:22:08 slappt01 tomcat9[25273]: Deployment does not provide any case definitions.
Nov 04 11:22:08 slappt01 tomcat9[25273]: SPIN-01010 Discovered Spin data format provider: org.camunda.spin.impl.json.jackson.format.JacksonJs
onDataFormatProvider[name = application/json]
Nov 04 11:22:08 slappt01 tomcat9[25273]: SPIN-01010 Discovered Spin data format provider: org.camunda.spin.impl.xml.dom.format.DomXmlDataForm
atProvider[name = application/xml]
Nov 04 11:22:08 slappt01 tomcat9[25273]: SPIN-01009 Discovered Spin data format: org.camunda.spin.impl.xml.dom.format.DomXmlDataFormat[name =
application/xml]
Nov 04 11:22:08 slappt01 tomcat9[25273]: SPIN-01009 Discovered Spin data format: org.camunda.spin.impl.json.jackson.format.JacksonJsonDataFor
mat[name = application/json]
Nov 04 11:22:08 slappt01 tomcat9[25273]: ENGINE-08050 Process application Menu App successfully deployed
Nov 04 11:22:08 slappt01 tomcat9[25273]: Deployment of web application archive [/var/lib/tomcat9/webapps/menu-planer.war] has finished in [4,
719] ms

Can you upload your process model?

Wow, you guys are fast :slight_smile: Thanks for asking, process model is attached.hsj-menuebestellung.bpmn (8.8 KB)

Hi, it looks like one of your listeners is set as an expression instead as a java class

Thanks for pointing out!
Unfortunately this wasn’t the problem. After fixing it, the module still didn’t work.

We still get the ‘cannot load class’-error.
Hence the module runs without a problem in the bundled version of camunda, we think that the problem might be caused by the class-loading of the tomcat. I don’t think that the problem is caused by the bpmn file. Do you know if there are any tomcat-settings which control the loading of classes?
Or is there anything else we can do, to enable the camunda-webapp to recognise our classes?

Thanks in advance
Sebastian / cibex GmbH

Can you please explain this answer further?

Unfortunately I do not understand the purpose of running .java-Files.
Hence we don’t run Java 11 or higher, we can’t compile classes at runtime. Therefore I don’t know how/why i should use .java-Files.

Thanks in advance
Sebastian / cibex GmbH

@cibex i have checked your bpmn, delegates are configured correctly, in addition to if you’ve corrected the delegates mentioned by @Niall in above post.

can you provide the server logs? can you upload your latest bpmn ? Also make sure delegates are in classpath.

Also, net.cibex.menuplaner.delegates.SetAssigneeDelegate this deelegate is meant for assigning tasks, it should be configured in event type = “assignment” instead of “create” event of a task.

upload this delegate for further analysis.

Yes we corrected the mention from @Niall
Unfortunately fixing the bpmn did not fix our problem.

I am not entirely sure if this would then still fulfil its purpose. For a better understanding: The net.cibex.menuplaner.delegates.SetAssigneeDelegate assigns the task to a person. I therefore think that changing the event type to “assignment” would brick the task.

How do we configure the classpath? Hence we are in a custom environment we think that this might be the error.

net.cibex.menuplaner.CamundaBpmProcessApplication: CamundaBpmProcessApplication - Pastebin.com
net.cibex.menuplaner.delegates.SetAssigneeDelegate: SetAssigneeDelegate - Pastebin.com

If you need anything else, please let me know!

Thanks in advance
Sebastian / cibex GmbH

An here are the other files:

Log: log.txt (57.7 KB)
and the BPMN: hsj-menuebestellung.bpmn (8.8 KB)

@cibex in which directory this class was stored net.cibex.menuplaner.delegates.StartInstancesDelegate ?

Provide the complete path to the above class and also the code.

Deployed in clustered environment?

If the class is not in the classpath follow the below instructions:

Tomcat JAR deployment options

How to make a JAR file available to your web applications at runtime. There are three recommended options to make this happen:

  1. Package the JAR file in the WEB-INF\lib folder of the Java web application;
  2. Place the JAR file in the \lib subfolder of the Apache Tomcat installation;
  3. Configure a folder for shared JAR files by editing Tomcat’s common.loader property in the catalina.properties file.

So the path to our class: /var/lib/tomcat9/webapps/menu-planer/WEB-INF/classes/net/cibex/menuplaner/delegates/StartInstancesDelegate.class

And the code:

We don’t build a Jar-File. We use the camunda-archetype-servlet-war-7.11.1 archetype and build a war-file, which we then deploy in the webapp-directory of the tomcat.

No just a tomcat installation with the camunda war.