Hi All,
I am trying to implement a simple java class for process serviceTask from kickstart app, my ultimate goal to use this class for stencils.
I was able to create a app with input from with takes two numbers and serviceTask to add both numbers and
returns result.
I used 9.0.16, java 8, activiti 6.0.0
When my serviceTask trys to call java application for processing which is on tomcat lib it is throwing exception.
org.apache.catalina.core.StandardWrapperValve.invoke Servlet.service() for servlet [appDispatcher] in context with path [/activiti-app]
threw exception [Request processing failed; nested exception is org.activiti.engine.ActivitiIllegalArgumentException: org.activiti.BasicAdditionDelegate
doesn't implement org.activiti.engine.delegate.JavaDelegate nor org.activiti.engine.impl.delegate.ActivityBehavior] with root cause
org.activiti.engine.ActivitiIllegalArgumentException: org.activiti.BasicAdditionDelegate doesn't implement org.activiti.engine.delegate.JavaDelegate
nor org.activiti.engine.impl.delegate.ActivityBehavior
My java class looks as below
import org.activiti.engine.delegate.DelegateExecution;
import org.activiti.engine.delegate.JavaDelegate;
public class BasicAdditionDelegate implements JavaDelegate {
@Override
public void execute(DelegateExecution execution) {
System.out.println("Inside execution ");
System.out.println(execution.getVariableNames());
System.out.println(execution.getVariables());
int firstOperandNumber = Integer.valueOf((String) execution.getVariable("firstOperand"));
int secondOperandNumber = Integer.valueOf((String) execution.getVariable("SecondOperand"));
int result = Math.addExact(firstOperandNumber, secondOperandNumber);
execution.setVariable("targetProcessVariable", String.valueOf(result));
}
}
Thanks in advance for any recommendations.
From a quick look the only differences I can see with my service tasks is that the execute() method throws Execption and explicitly returns, i.e.
public void execute(DelegateExecution e) throws Exception {
.....
return;
}
Thanks, PaulT _ for your inputs.
I tried with adding "throws Exception" but no luck with the same error.
and "return" method return type is void, do we have to add a return.
I never thought of adding a return to this method.
Do you think that may cause?
No I wouldn't have really thought either of those things would be the cause of the problem, but they were the only obvious differences I could see between my service tasks that work - so thought worth mentioning. I'm using the Java API directly in Activiti 5.22.
Hmmm. I am using Activiti 6.0.0.
One thing I observed with 6.0 is no longer required to throws Exception.
Only thing I think of now is a version difference. Let me try with 5.22 and see how it goes.
Ask for and offer help to other Alfresco Process Services and Activiti Users and members of the Alfresco team.
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.