cancel
Showing results for 
Search instead for 
Did you mean: 

activiti:class __ ActivitiIllegalArgumentException:

fahad1
Champ in-the-making
Champ in-the-making
I want to attach com.services.AutherticateUser_WS class with my service Task.
<serviceTask id="sid-6A5A3583-D7C9-4188-81BC-58C6C16F681C" name="myService" activiti:class="com.services.AutherticateUser_WS"></serviceTask>

But I am getting the following error
Caused by: org.activiti.engine.ActivitiIllegalArgumentException: com.services.AutherticateUser_WS doesn't implement org.activiti.engine.delegate.JavaDelegate nor org.activiti.engine.impl.pvm.delegate.ActivityBehavior


Infact, my class implements this. Below is the code of my class.


package com.services;

import org.activiti.engine.RuntimeService;
import org.activiti.engine.delegate.DelegateExecution;

import org.activiti.engine.delegate.JavaDelegate;
import org.activiti.engine.impl.pvm.delegate.ActivityBehavior;
import org.activiti.engine.impl.pvm.delegate.ActivityExecution;

public class AutherticateUser_WS implements JavaDelegate, ActivityBehavior {


   @Override
   public void execute(DelegateExecution execution) throws Exception {
      // TODO Auto-generated method stub
      
      System.out.println( " some thing is running ");
      RuntimeService runtimeService = execution.getEngineServices().getRuntimeService();
       runtimeService.startProcessInstanceByKey("process123");
      
   
      
      String group = (String) execution.getVariable("group");
        System.out.println(group);
      
   }

   @Override
   public void execute(ActivityExecution execution) throws Exception {
      // TODO Auto-generated method stub
      System.out.println( "some thing is running ");
      RuntimeService runtimeService = execution.getEngineServices().getRuntimeService();
       runtimeService.startProcessInstanceByKey("process123");
      
   }

}


Any idea to fix this error
4 REPLIES 4

jbarrez
Star Contributor
Star Contributor
You only need to implement the ActivityBehaviour class. The JavaDelegate is only a subset of it.

fahad1
Champ in-the-making
Champ in-the-making
thanks Dear jbarrez. But I am yet not able to execute it. Now I am only implementing ActivityBehaviour, but still getting the same error
Caused by: org.activiti.engine.ActivitiIllegalArgumentException: fitman.services .AutherticateUser_WS doesn't implement org.activiti.engine.delegate.JavaDelegate nor org.activiti.engine.impl.pvm.delegate.ActivityBehavior
        at org.activiti.engine.impl.bpmn.helper.ClassDelegate.getActivityBehaviorInstance(ClassDelegate.java:143)
        at org.activiti.engine.impl.bpmn.helper.ClassDelegate.execute(ClassDelegate.java:113)


Code of my class is as follows.

import org.activiti.engine.RuntimeService;
import org.activiti.engine.impl.pvm.delegate.ActivityBehavior;
import org.activiti.engine.impl.pvm.delegate.ActivityExecution;

public class AutherticateUser_WS implements   ActivityBehavior  {


@Override
public void execute(ActivityExecution execution) throws Exception {
  // TODO Auto-generated method stub
  System.out.println( " 11 some thing is running ");
  RuntimeService runtimeService = execution.getEngineServices().getRuntimeService();
     runtimeService.startProcessInstanceByKey("process123");
 
}

}

Any hint?  any project code or help for getting started.

trademak
Star Contributor
Star Contributor
Already answered in your other post. It basically says is already in the exception message. You should implement the JavaDelegate interface and not the ActivityBehavior class.

Best regards,

fahad1
Champ in-the-making
Champ in-the-making
as jbarrez said. we can implement either class javaDelegate or ActivityBehavior. The JavaDelegate is only a subset of  ActivityBehavior.
anyways, its running now.

thanks for the feedback