Loading external classes in tomcat

Hi Folks,

Camunda 7.5-alpha2
tomcat 8

I have a process application deployed and i want the service tasks to run some classes that are not deployed in the same war (the models) - but they are on tomcat somewhere. using the path of the class doesn’t work… so any ideas?
Whats the best way to do this?

Hi Niall,

I 'm afraid you’ll have to give more exact description of somewhere.

In general, classes can be part of the process application or as libraries in Tomcat’s lib folder. In the latter case, they are visible to all applications deployed to Tomcat.

Cheers,
Thorben

Within server.xml there is an entry:

<Context docBase="/Sites/cms/web" parth="" reloadable="false" />

that folder is the location of the application which contains the classes.
And thats what we need to contact.

Hi Niall,

this entry defines a new web application, and tomcat docs says (https://tomcat.apache.org/tomcat-8.0-doc/class-loader-howto.html):

WebappX — A class loader is created for each web application that is deployed in a single Tomcat instance. All unpacked classes and resources in the /WEB-INF/classes directory of your web application, plus classes and resources in JAR files under the /WEB-INF/lib directory of your web application, are made visible to this web application, but not to other ones.

So I think, maven will help you with packaging the classes from the other app into your application, too.

Hope this helps,

Ingo

We have Camunda’s the standalone download of tomcat. Camunda works just fine - we have a camunda project application deployed to that tomcat - which also works fine.

But there is another application that needs to contact the engine to find out about what task are available.

This other application (appX) is not actually a deployed process application on tomcat - it’s in a “docBase context.”
We’re not just trying to get access to the process engine from that application.

What we’re trying to do in order to get access to the process engine is - adding the following to appX’s web.xml file:

<!-- bind the process engine service as Spring Bean -->
  <bean name="processEngineService" class="org.camunda.bpm.BpmPlatform" factory-method="getProcessEngineService" />

  <!-- bind the default process engine as Spring Bean -->
  <bean name="processEngine" factory-bean="processEngineService" factory-method="getDefaultProcessEngine" />

But when i then ask for the default process engine in code it returns null… so there’s obviously something I’m missing. Any ideas?

Hi Niall,

It’s just a guess: Because of classloader isolation the two applications cannot access classes from the other app. So you have to integrate the engine into the existing appX and start it as written in the Spring get started guide.

I think you missed some steps to start the process engine here so the process engine is null.

Hope this helps, Ingo