Unable to call javadelegate class
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-01-2016 07:16 AM
Hi,
I'm new to activiti. I have a created a stand-alone java application with simple process like[ Start->ServiceTask->End ]. Below are the files are using in sample application, Main.java, MyJavaDelegate.java & bpmn files. When running this application i'm getting below exception:
Exception: [Validation set: 'activiti-executable-process' | Problem: 'activiti-servicetask-missing-implementation'] : One of the attributes 'class', 'delegateExpression', 'type', 'operation', or 'expression' is mandatory on serviceTask. - [Extra info : processDefinitionId = helloWorld | id = myServiceTask | ] ( line: 10, column: 92) ————-
I thought, i should register JavaDelegate class instance with ActivitiRuntimeEngine. Please suggest?
Below are the files:
——————————————————————————–
Main.java
——————————————————————————–
public class Main {
public static void main(String[] args) throws ClassNotFoundException {
try {
// Create the Activiti engine in-memory on H2 database
ProcessEngineConfiguration engineConfig = ProcessEngineConfiguration.createStandaloneInMemProcessEngineConfiguration();
ProcessEngine processEngine = engineConfig.buildProcessEngine();
processEngine.getRepositoryService().createDeployment()
.addClasspathResource("hello-world.bpmn20.xml")
.deploy();
ProcessInstance processInstance = processEngine.getRuntimeService()
.startProcessInstanceByKey("helloWorld");
System.out.println("Process instance id:" + processInstance.getId());
processEngine.close();
} catch (Exception e) {
e.printStackTrace();
}
}
}
——————————————————————————–
MyJavaDelegate.java . This files was placed in 'org.sample.delegates' package.
——————————————————————————–
public class MyJavaDelegate implements JavaDelegate {
@Override
public void execute(DelegateExecution execution) throws Exception {
System.out.println("Service task called…");
}
}
——————————————————————————–
hello-world.bpmn20
——————————————————————————–
<?xml version="1.0" encoding="UTF-8"?>
<definitions id="definitions"
xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL"
xmlns:activiti="http://activiti.org/bpmn-extensions"
targetNamespace="http://www.activiti.org/bpmn2.0">
<process id="helloWorld">
<startEvent id="theStart" />
<sequenceFlow id="flow1" sourceRef="theStart" targetRef="myServiceTask" />
<serviceTask id="myServiceTask" activiti:class="org.sample.delegates.MyJavaDelegate" />
<sequenceFlow id="flow2" sourceRef="myServiceTask" targetRef="theEnd" />
<endEvent id="theEnd" />
</process>
</definitions>
I'm new to activiti. I have a created a stand-alone java application with simple process like[ Start->ServiceTask->End ]. Below are the files are using in sample application, Main.java, MyJavaDelegate.java & bpmn files. When running this application i'm getting below exception:
Exception: [Validation set: 'activiti-executable-process' | Problem: 'activiti-servicetask-missing-implementation'] : One of the attributes 'class', 'delegateExpression', 'type', 'operation', or 'expression' is mandatory on serviceTask. - [Extra info : processDefinitionId = helloWorld | id = myServiceTask | ] ( line: 10, column: 92) ————-
I thought, i should register JavaDelegate class instance with ActivitiRuntimeEngine. Please suggest?
Below are the files:
——————————————————————————–
Main.java
——————————————————————————–
public class Main {
public static void main(String[] args) throws ClassNotFoundException {
try {
// Create the Activiti engine in-memory on H2 database
ProcessEngineConfiguration engineConfig = ProcessEngineConfiguration.createStandaloneInMemProcessEngineConfiguration();
ProcessEngine processEngine = engineConfig.buildProcessEngine();
processEngine.getRepositoryService().createDeployment()
.addClasspathResource("hello-world.bpmn20.xml")
.deploy();
ProcessInstance processInstance = processEngine.getRuntimeService()
.startProcessInstanceByKey("helloWorld");
System.out.println("Process instance id:" + processInstance.getId());
processEngine.close();
} catch (Exception e) {
e.printStackTrace();
}
}
}
——————————————————————————–
MyJavaDelegate.java . This files was placed in 'org.sample.delegates' package.
——————————————————————————–
public class MyJavaDelegate implements JavaDelegate {
@Override
public void execute(DelegateExecution execution) throws Exception {
System.out.println("Service task called…");
}
}
——————————————————————————–
hello-world.bpmn20
——————————————————————————–
<?xml version="1.0" encoding="UTF-8"?>
<definitions id="definitions"
xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL"
xmlns:activiti="http://activiti.org/bpmn-extensions"
targetNamespace="http://www.activiti.org/bpmn2.0">
<process id="helloWorld">
<startEvent id="theStart" />
<sequenceFlow id="flow1" sourceRef="theStart" targetRef="myServiceTask" />
<serviceTask id="myServiceTask" activiti:class="org.sample.delegates.MyJavaDelegate" />
<sequenceFlow id="flow2" sourceRef="myServiceTask" targetRef="theEnd" />
<endEvent id="theEnd" />
</process>
</definitions>
Labels:
- Labels:
-
Archive
3 REPLIES 3
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-01-2016 07:32 AM
Hi, forget to attach process definition:
<process id="helloWorld">
<startEvent id="theStart" />
<sequenceFlow id="flow1" sourceRef="theStart" targetRef="myServiceTask" />
<serviceTask id="myServiceTask" activiti:class="org.sample.delegates.MyJavaDelegate" />
<sequenceFlow id="flow2" sourceRef="myServiceTask" targetRef="theEnd" />
<endEvent id="theEnd" />
</process>
<process id="helloWorld">
<startEvent id="theStart" />
<sequenceFlow id="flow1" sourceRef="theStart" targetRef="myServiceTask" />
<serviceTask id="myServiceTask" activiti:class="org.sample.delegates.MyJavaDelegate" />
<sequenceFlow id="flow2" sourceRef="myServiceTask" targetRef="theEnd" />
<endEvent id="theEnd" />
</process>
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-01-2016 08:27 AM
Hi,
You can start investigating it with a breakpoint in : ServiceTaskValidator.java on the method:
<code>
protected void verifyImplementation(Process process, ServiceTask serviceTask, List<ValidationError> errors)
</code>
Which version of Activiti are you using?
You can start investigating it with a breakpoint in : ServiceTaskValidator.java on the method:
<code>
protected void verifyImplementation(Process process, ServiceTask serviceTask, List<ValidationError> errors)
</code>
Which version of Activiti are you using?
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-01-2016 11:04 AM
At last, i figured out the issue. Problem is with activiti version. I'm using 5.19, in that, name space should be
"xmlns:activiti="http://activiti.org/bpmn".
@vasile.dirla: Thank you very much for quick help. You simply great
"xmlns:activiti="http://activiti.org/bpmn".
@vasile.dirla: Thank you very much for quick help. You simply great

