AnsweredAssumed Answered

ActivitiIllegalArgumentException: org.activiti.BasicAdditionDelegate  doesn't implement org.activiti.engine.delegate.JavaDelegate

Question asked by harshamendu on Feb 12, 2019
Latest reply on Feb 12, 2019 by harshamendu

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 tomcat 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.

Outcomes