Process started in camunda/app/tasklist works fine; Process started in custom webapps/app/tasklist throws cannot load class - exception (WildFly 22 / JBoss 7)

Hello

If the processes (an-processes.war) are started in http://localhost:8080/camunda/app/tasklist (camunda-webapp-jboss-7.15.0.war), it works fine.

If the processes (an-processes.war) are started in http://localhost:8080//webapps/app/tasklist (an-webapp.war) a “cannot load class” exception is thrown.

<bpmn:serviceTask id=“Srv920020_SC_Administration_Connection” name=“Srv920020_SC_Administration_Connection” camunda:class=“ch.admin.wbf.SC.actanova.camunda.Process920.Srv920020_SC_Administration_ConnectionDelegate”>

In the camunda-webapp-jboss-7.15.0.war – case the delegate camunda:class the deployment. camunda-webapp-jboss-7.15.0.war Service Module Loader can find the delegate on the other hand the deployment.an-webapp.war Service Module Loader cannot find the delegate.

What could be the reason?

The same behavior can be observed in WildFly 22 as well as in Jboss7.

Thank you Christopher

12:43:19,411 INFO [org.jboss.as.server] (ServerService Thread Pool – 47) WFLYSRV0010: Deployed “ch.admin.wbf.SC.webapp.war” (runtime-name : “an-webapp.war”)

12:43:19,412 INFO [org.jboss.as.server] (ServerService Thread Pool – 47) WFLYSRV0010: Deployed “camunda-welcome.war” (runtime-name : “camunda-welcome.war”)

12:43:19,418 INFO [org.jboss.as.server] (ServerService Thread Pool – 47) WFLYSRV0010: Deployed “camunda-webapp-jboss-7.15.0.war” (runtime-name : “camunda-webapp-jboss-7.15.0.war”)

12:43:19,419 INFO [org.jboss.as.server] (ServerService Thread Pool – 47) WFLYSRV0010: Deployed “camunda-h2-webapp-7.15.0.war” (runtime-name : “camunda-h2-webapp-7.15.0.war”)

12:43:19,421 INFO [org.jboss.as.server] (ServerService Thread Pool – 47) WFLYSRV0010: Deployed “camunda-engine-rest-7.15.0.war” (runtime-name : “camunda-engine-rest-7.15.0.war”)

12:43:19,422 INFO [org.jboss.as.server] (ServerService Thread Pool – 47) WFLYSRV0010: Deployed “an-processes.war” (runtime-name : “an-processes.war”)

ENGINE-09008 Exception while instantiating class ‘ch.admin.wbf.SC.actanova.camunda.Process920.Srv920010_SC_Administration_ConfigDelegate’: ENGINE-09017 Cannot load class ‘ch.admin.wbf.SC.actanova.camunda.Process920.Srv920010_SC_Administration_ConfigDelegate’: ch.admin.wbf.SC.actanova.camunda.Process920.Srv920010_SC_Administration_ConfigDelegate from [Module “deployment.an-webapp.war” from Service Module Loader]

camunda-webapp-jboss-7.15.0.war

The case where it works fine the classloader takes the deployment.an-processes.war - module

ENGINE-09016 Attempting to load class ‘ch.admin.wbf.SC.actanova.camunda.Process920.Srv920010_SC_Administration_ConfigDelegate’ with current thread context classloader**: ModuleClassLoader for Module “deployment.an-processes.war”** from Service Module Loader

an-webapp.war

The case where it does not work the class loader uses the deployment.ch.admin.wbf.SC.webapp.war module and not the correct deployment.an-processes.war – module.

2021-08-17 09:13:49,906 DEBUG [org.camunda.bpm.engine.util] (default task-3) ENGINE-09016 Attempting to load class ‘ch.admin.wbf.SC.actanova.camunda.Process920.Srv920010_SC_Administration_ConfigDelegate’ with current thread context classloader: ModuleClassLoader for Module “deployment.ch.admin.wbf.SC.webapp.war” from Service Module Loader

Possible source code used

ClassLoader contextClassloader = ClassLoaderUtil.getContextClassloader();
if(contextClassloader != null) {
LOG.debugClassLoading(className, “current thread context classloader”, contextClassloader);
clazz = Class.forName(className, true, contextClassloader);