Classpath for JavaDelegate

This a probably a absolute beginners mistake.
I downloaded the 7.6.0 Tomcat distribution and I trying to get my first JavaDelegate.

I have created a WAR file that contains 2 simple classes & a BPMN file.
When copying the war file to the webapp folder, the process deploys automatically.
I can start a process instance using the Tasklist webgui, the process blocks at the service task:

The process could not be started. : Cannot instantiate process definition test:9:b2ce937e-e483-11e6-873f-0ecf8b62d705: ENGINE-09008 Exception while instantiating class 'eu.telecomplaza.test.simpleDelegate': ENGINE-09017 Cannot load class 'eu.telecomplaza.test.simpleDelegate': eu.telecomplaza.test.simpleDelegate

package eu.telecomplaza.test;

import org.camunda.bpm.application.ProcessApplication;
import org.camunda.bpm.application.impl.ServletProcessApplication;


@ProcessApplication("Test app")
public class Application extends ServletProcessApplication {

    public Application() {
    }
}

and the JavaDelegate:

package eu.telecomplaza.test;

import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.camunda.bpm.engine.delegate.JavaDelegate;

public class simpleDelegate implements JavaDelegate{

	public void execute(DelegateExecution execution) throws Exception {

	      execution.setVariable("channel", "EPT");
	}

}

Can someone help me in setting up the classpath correctly so that the JavaDelegate is found in the war file?

Could you please share the sources of your application on github?

The same problem occurs on the Camunda example on GitHub:

macOS Sierra, Java 8 OpenJDK, built with maven 3.5, deployed on the recommended Tomcat distribution from camunda.org/download

Hi @steffenbrand,

Could you please post exact (and minimal) steps to reproduce this?

Cheers,
Thorben

The steps were:

  • Clone project from github.
  • Checkout Step-5.
  • Remove user-task from process.
  • Change delegate to just print something.
  • mvn clean install
  • deploy application
  • start process instance via rest api ‘/engine-rest/process-definition/key/approve-loan/start’
  • Get the error: Cannot instantiate process definition approve-loan:2:cceac6d4-3ecf-11e7-ab3b-08002756ae3f: ENGINE-09008 Exception while instantiating class ‘org.camunda.bpm.getstarted.loanapproval.ProcessRequestDelegate’: ENGINE-09017 Cannot load class ‘org.camunda.bpm.getstarted.loanapproval.ProcessRequestDelegate’: org.camunda.bpm.getstarted.loanapproval.ProcessRequestDelegate

HOWEVER:
I just tried this again to verify my results and now I am not getting an error. It works fine.
I remember one time where I also used the Camunda Spin plugin to handle a Json variable and the error occured.

Sometimes I get the feeling that I can force this error if I just keep redeploying the application until it is broken.

I’m pretty new to Camunda and cannot provide any actual “qualified” hints on how to reproduce the error properly.

Best regards

Steffen

Some additional information:

When I add the Camunda Spin plugin to the application, the error occurs again.
If I remove Spin afterwards and redeploy the application, the error remains.
I can only get rid of the error, if I delete all deployments in Camunda (using the gui) and then restart the Tomcat.
When I now deploy my application again, the error is gone.

Best regards

Steffen

The very same problem occured to me. Using ‘Delegate expression’ instead of ‘Java Class’ solved it for me.

It depends on how the deployment is performed:

When I stop Tomcat, delete the folder and replace the war file and start Tomcat -> I have the same problem.
When I don’t stop Tomcat and simply delete the folder and replace the war file -> The problem doesn’t occur.

any update on this issue i am also facing the same issue

have you got soloution for this issue

@Anoop_Tiwari can you upload your bpmn file here?

I’m using delegate expression but still the problem persists. Any Solution?

I have exact the same problem. Checked out the loanapproval example and deployed to camunda 7.12.0.
Has anybody solved the problem?

Sorry, my mistake.
I didn’t saved the bpmn file to the *.war file as described in the tutorial:
https://docs.camunda.org/get-started/java-process-app/deploy/

If I deploy the model separately with the camunda modeler, I get the error ENGINE-09008 .
If the bpmn file is part of the *.war file, everything works just fine.