Accessing Java classes when process is deployed from modeler

I made a BPMN process that uses custom java classes (validation, listeners, …).
When I put the BPMN process inside the war that contains the java classes and deploy it to the engine, it can access the java classes.
But when I deploy the BPMN process from the modeler or using REST API, it can’t find the custom java classes although they are deployed to the engine in a separate WAR.
I don’t want to deploy the war for any change in the process, I need a way to tell the process to look for the classes in the custom WAR that is already deployed
Is there a way to achieve this ?

If you want the process to pick up java classes you need to deploy them together.
The other option is the use External Tasks instead of classes, then you could deploy the model and code independently.

Hi Niall,
I noticed that when I deploy the war 1 time with bpmn diagrams and then make modification to bpmn diagram and redeploy the diagram from the modeler without redeploying the war, in this case the bpmn process can see the classes.
I guess there may be a configuration that tells the bpmn diagram where to look for classes,
the standalone deployed processes always try to look for the classes in “deployment.camunda-webapp-jboss-7.10.0.war” and throws an error when they can’t find them

Thats true - but you’re going to run into trouble when you restart the server. When you deploy the model via the WAR file a file will exist as an entity on the application service. It is then picked up by the engine and stored as XML in the database. So when you then deploy a new version of the same process via the rest API it overwrites the database entry but does not change the file in the WAR. So if you restart your service it will then re-deploy the old model which is stored in the WAR file.

I hope this helps you understand that this approach is not going to work for production. :slight_smile:

1 Like

Hi Niall,
I tried to restart the server, and it is working without problems.
I agree with you that this strange behavior isn’t guaranteed to work in production.
But I need a way to give business users the flexibility to make some changes in the process that doesn’t need to change java code and deploy the diagram directly without changing the war that contains custom java classes.

That is a common requirement and as i suggested External Tasks are the best way of achieving it.

External task will not work as Task Listener or Form Validator
It works only as an implementation for a service task

Yup, If you’re using listeners for validation you could use scripts instead (but thats not a great solution either)

Looks like you’re going to need to make some compromises.

Hi @zmadel,

this post may provide some insights: BPMN files in Process application war file

Hope this helps, Ingo

Thank you
This post have the solution for my problem