Delegates from ServiceTasks are not found if started from Camunda TaskList

Hello,
if we deploy the bpmn processes on our own like this:

    DeploymentBuilder builder = processEngine.getRepositoryService().createDeployment();
    builder.addClasspathResource(process.getPath());
    builder.name(process.getKey());

We get the following exception in the Web Interface when the ServiceTask where the Delegate is attached should be started.

An error happend while submitting the task form :
Cannot submit task form ba07ebfe-b87e-11e6-b453-7c7a910884a5: ENGINE-09008 Exception while instantiating class ‘aware.pdfreport.delegate.PDFReportDelegate’: ENGINE-09017 Cannot load class ‘aware.pdfreport.delegate.PDFReportDelegate’: aware.pdfreport.delegate.PDFReportDelegate

The delegate is definitely in the war file which is deployed to the tomcat.

Everything works, if we automate the deployment through using the processes.xml. But this is not really an option for us since we want to control which processes are deployed.

Is there some parsing of the bpmn files in the background happening, if the processes.xml is used, to attach all delegates defined in the bpmn file to the classpath?

Best regards and thanks in advance,
Hendrik

Hi Hendrik,

You have to register a process application for the deployment in order for a shared engine to be able to load classes from a custom web application (see https://docs.camunda.org/manual/7.6/user-guide/process-applications/process-application-resources/ for some details on the general concept). This is done automatically when deploying a process application and you can do that manually via ManagementService#registerProcessApplication. That means, no process application == no custom class loading with shared engine. Note that with a process application deployment, a custom process application class can override the method #createDeployment to programmatically add resources.

Cheers,
Thorben

Hey @thorben,

thanks a lot for your answer.

It helped a lot, the complete deployment looks like this now:

        DeploymentBuilder builder = processEngine.getRepositoryService().createDeployment();
        builder.addClasspathResource(process.getPath());
        builder.name(process.getKey());

        Deployment d = builder.deploy();

        processEngine.getManagementService().registerProcessApplication(d.getId(), this.reference);

And it really seems like the last line was the missing point. (Where “this” is a ServletProcessApplication).