Make Java Delegate available for all processes

I have setup a Java Web project that contains the Java Delegates I want to use across all processes that get deployed in Camunda.

I noticed that this java delegate is only available to processes that are deployed along with the Java web project.

If I deploy a new process using Create Deployment REST API then that process cannot access the Java delegate. Gives ClassNotFoundException.

How can I make the java delegate available to all processes deployed not by the Java web project but by other methods?

Please create a jar file with the java delegate and copy it to the lib folder of the Camunda distribution and try.

Hello,
I am using Docker image of Tomcat distribution of Camunda. In which directory, I will need to copy the jar that contains the delegate classes? Also, where to copy the dependent jars?

First of all , you should understand that a web application ( process application that contains your java delegates) cannot be deployed through rest api.
You have to deploy it like any other web application
Ie through manager console or copy it to the webapps folder and restart the server.

You can copy the jar that contains delegates shared across the projects to the lib folder inside tomcat. You need not copy the dependencies if you are using maven. Because the war file itself contains the dependencies unless scope defined for the dependencies are changed.

3 Likes

Hi there,
I have the same problem here. It seems, that it is necessary to create a process application, but I don’t know why. Why can’t I just put my JAR file with the delegates in the right folder (something like tomcat/lib or tomcat/webapps/engine-rest/WEB-INF/lib and the Java class loader finds and loads it from there? It should be a normal Java class loading process and I don’t understand why it does not seem to work as expected here.
Regards
René

Hi @rpeinl,

It depends on the distribution, but a general answer would be “because of java classloaders”.

Wildfly has a decent mechanism to separate Classes loaded from different scopes, where the container managed engine is one of these scopes and each deployed application runs in a different scope.

Spring Boot has just a single class loader and uses the embedded engine. Here it may become more complex to organize different processes with different delegates in the same engine, but technically it would be simpler than in the Wildfly universe.

Hope that helps, Ingo

1 Like

Thanks for the answer.
It is unfortunately not really helpful. If I deploy my processes via REST, they should run in the engine-rest context in Tomcat (I’m unsing Tomcat instead of Wildfly). Therefore, the question is: where do I have to put my jar, so that it can be loaded by the class loader in the engine-rest context. I tried camunda/lib, tomcat/lib, webapps/engine-rest/WEB-INF/lib but all without succes. I thought I would roughly understand how the Java class loader works, but obviously I do not understand enough about Camunda to understand which parts of the applications are used in which situations.
I don’t won’t to create an own process application, since I’m only working on a small demo with a single service task.
I have even tried to use the new feature of the camunda modeler to deploy “other files” together with a process, but that only seems to work for forms, not for JARs, which is really a pity.

Hi @rpeinl,

do you use the Tomcat distro that you can download here: Camunda Download Center -?

If yes, you can put your jar file into the camunda-bpm-ee-tomcat-7.16.1-ee\server\apache-tomcat-9.0.52\lib folder. You can find the camunda-engine.jar in this folder, too.

Hope this helps, Ingo

1 Like

Thanks that worked