I have one Delegate class inside my bpm project , here is my class exmple
public class AddClass implements JavaDelegate {
public void execute(DelegateExecution execution) throws Exception {
String var = (String) execution.getVariable("input");
var = var.toUpperCase();
execution.setVariable("input", var);
}
public String sayHello() {
return "hello";
}
}
and i want to invoke this class inside camunda modeller i have tried implementing Delegate expression and it’s relative value ${AddClass.sayHello()} , i have even tried to implement it as a java class but in both cases i have received class not found exception, what should i change to make my bpm logic work?
if you have a Java class, you have to set the Java Class Property in the properties panel of the modeler. The configuration need the whole package and the class name.
When the process execution arrives this delegate, it will execute the execute method. This means,
you have to call the sayHello method in your execute method.
I have some external jars which I have added as dependencies into the pom.xml file. I have created a local repository which is the lib folder under the main project. Once I added these dependencies, when I deployed the war file, the processEngine throws the exception ClassNotFound:
The process could not be started.: Cannot instantiate process definition PingTest:3:a6d23111-7def-11ea-bc4c-98e743bed6bc: ENGINE-09008 Exception while instantiating class ‘camunda.ExecutePingSMSDelegateTrial’: ENGINE-09017 Cannot load class ‘camunda.ExecutePingSMSDelegateTrial’: camunda.ExecutePingSMSDelegateTrial
How do you refer to your Delegate? Are you using the fully qualified classpath or a Delegate Expression?
Does your Delegate implement the JavaDelegate interface?
Can you show the relevant part of your model and delegate?
Yes, multiple times.
I noticed one thing, when I remove the dependency from the the pom.xml file, it can find the JavaDelegate class.
When I add the dependency again, it throws “Cannot find the class”.
I have also tried to add the dependency using the systemPath tag, when I do that, it cannot locate the class file in the external jars.