I have added a Java class for a service task to the server/apache-tomcat-8.0.47/webapps/camunda/WEB-INF/classes folder.
When I run the process from the Camunda studio (Start Process in the Tasklist window), it works fine.
However, starting the process using the REST API does not work. The reason in the log is a ClassNotFoundException for my Java class. (I tested using Postman).
Where do I need to place Java classes for service tasks so that process instances started via the REST API may find them?
Thanks for the link, but the question is why the class is found when the process is started when inside of the studio, and why the class is not found when the process is started via the REST API. Aren’t the class paths supposed to be the same?
That is not the case. You added the class to the web application’s classpath, but the REST API is a separate application (check for engine-rest in the web applications folder). Besides, the recommended approach is the one described in the guide Ben linked. It is cleaner and you can provide your classes as a separate artifact.
I have another question on the class loader for processes started by a Start Timer Event.
I have a process that contains a Service Task that is implemented by a Java class. I have placed the class in webapps/camunda/WEB-INF/classes for when the process is started in the Camunda studio, and in webapps/engine-rest/WEB-INF/classes for when the process is started via the REST API. This works fine.
However, when the process start event is changed to a Timer Start Event, the service task throws a ClassNotFoundException. Where should I place my Java class?