Safe to use ProcessEngineConfigurationImpl.setClassloader?

We are embedding Camunda into our product, and our product has some JavaDelegate classes we want to make available to all BPFlows, including those deployed as separate war files on our server.

We are using JBoss with the shared process model, and we currently deploy our JavaDelegate classes in our EAR file.

Our current thinking is to create an Engine plugin that sets our EAR file classloader as the classloader for Camunda. This makes the JavaDelegates from the EAR available to the shared engine. The API we are using is:
https://docs.camunda.org/javadoc/camunda-bpm-platform/7.3/org/camunda/bpm/engine/impl/cfg/ProcessEngineConfigurationImpl.html#setClassLoader(java.lang.ClassLoader)

In our initial tests, this seems to work. Does this sound like a valid approach? We did have some concerns about messing with the Camunda classloader and any unexpected problems this may cause.

Hi @tom_p,

I can’t answer the title question but I may be able to provide some insight:

  • The classloader is used whenever the process engine tries to load custom classes or classpath resources; if it cannot do so, it falls back to the thread context class loader
  • This configuration option is not extensively tested in the engine test suite

My recommendation is:

  • if you want to use that setting, test its behavior until you feel comfortable using it
  • I personally would deploy the delegates as a JBoss module instead and declare a dependency from every process application to it; this avoids using the engine classloader option and you still have the delegates in one place

Cheers,
Thorben