Service Task Error
biswajit.sarkar Mar 5, 2015 1:19 PMHi,
I am using jbpm.6.1.0.Final in our Dev environment.
I am trying to create a simple process where i have added a "Service Task" to call a java method(which I add as a dependency jar of my project).
following is my simple java class which I try to invoke from "Service Task"
package com.test;
public class TestService {
public String hello(String arg1){
System.out.println("arguument :"+arg1);
return arg1;
}
}
I have created a jar of this class and upload it to the "Artifact Repository". And then add this as a dependency of my project.
But when I try to invoke that method "hello" I am getting "NoSuchMethod Exception"
following is my process code
<?xml version="1.0" encoding="UTF-8"?>
<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.omg.org/bpmn20" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:bpsim="http://www.bpsim.org/schemas/1.0" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:drools="http://www.jboss.org/drools" id="_hvuukcNiEeSc-sL6266JgQ" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd http://www.jboss.org/drools drools.xsd http://www.bpsim.org/schemas/1.0 bpsim.xsd" expressionLanguage="http://www.mvel.org/2.0" targetNamespace="http://www.omg.org/bpmn20" typeLanguage="http://www.java.com/javaTypes">
<bpmn2:itemDefinition id="_inputItem" structureRef="String"/>
<bpmn2:itemDefinition id="_outputItem" structureRef="String"/>
<bpmn2:itemDefinition id="_19F79C80-D33E-45CC-A82F-F15871139096_InMessageType"/>
<bpmn2:message id="_19F79C80-D33E-45CC-A82F-F15871139096_InMessage" itemRef="_19F79C80-D33E-45CC-A82F-F15871139096_InMessageType"/>
<bpmn2:interface id="_19F79C80-D33E-45CC-A82F-F15871139096_ServiceInterface" name="com.test.TestService" implementationRef="com.test.TestService">
<bpmn2:operation id="_19F79C80-D33E-45CC-A82F-F15871139096_ServiceOperation" name="hello" implementationRef="hello">
<bpmn2:inMessageRef>_19F79C80-D33E-45CC-A82F-F15871139096_InMessage</bpmn2:inMessageRef>
</bpmn2:operation>
</bpmn2:interface>
<bpmn2:itemDefinition id="__19F79C80-D33E-45CC-A82F-F15871139096_ParameterInputXItem" structureRef="String"/>
<bpmn2:itemDefinition id="__19F79C80-D33E-45CC-A82F-F15871139096_ResultOutputXItem" structureRef="String"/>
<bpmn2:process id="Project2.TestProcess2_project2" drools:packageName="org.jbpm" drools:version="1.0" name="TestProcess2_project2" isExecutable="true">
<bpmn2:property id="input" itemSubjectRef="_inputItem"/>
<bpmn2:property id="output" itemSubjectRef="_outputItem"/>
<bpmn2:startEvent id="processStartEvent" drools:bgcolor="#9acd32" drools:selectable="true" name="">
<bpmn2:outgoing>_1C8728AD-4F67-452C-942B-25668B9FCB41</bpmn2:outgoing>
</bpmn2:startEvent>
<bpmn2:serviceTask id="_19F79C80-D33E-45CC-A82F-F15871139096" drools:selectable="true" drools:serviceimplementation="Java" drools:serviceoperation="hello" drools:serviceinterface="com.test.TestService" name="Service Task" implementation="Java" operationRef="_19F79C80-D33E-45CC-A82F-F15871139096_ServiceOperation">
<bpmn2:incoming>_1C8728AD-4F67-452C-942B-25668B9FCB41</bpmn2:incoming>
<bpmn2:outgoing>_5FB809EC-0CFE-49A1-848C-107A5D2B0FD1</bpmn2:outgoing>
<bpmn2:ioSpecification id="_hvyY8MNiEeSc-sL6266JgQ">
<bpmn2:dataInput id="_19F79C80-D33E-45CC-A82F-F15871139096_ParameterInputX" drools:dtype="String" itemSubjectRef="__19F79C80-D33E-45CC-A82F-F15871139096_ParameterInputXItem" name="Parameter"/>
<bpmn2:dataOutput id="_19F79C80-D33E-45CC-A82F-F15871139096_ResultOutputX" drools:dtype="String" itemSubjectRef="__19F79C80-D33E-45CC-A82F-F15871139096_ResultOutputXItem" name="Result"/>
<bpmn2:inputSet id="_hvyY8cNiEeSc-sL6266JgQ">
<bpmn2:dataInputRefs>_19F79C80-D33E-45CC-A82F-F15871139096_ParameterInputX</bpmn2:dataInputRefs>
</bpmn2:inputSet>
<bpmn2:outputSet id="_hvyY8sNiEeSc-sL6266JgQ">
<bpmn2:dataOutputRefs>_19F79C80-D33E-45CC-A82F-F15871139096_ResultOutputX</bpmn2:dataOutputRefs>
</bpmn2:outputSet>
</bpmn2:ioSpecification>
<bpmn2:dataInputAssociation id="_hvyY88NiEeSc-sL6266JgQ">
<bpmn2:sourceRef>input</bpmn2:sourceRef>
<bpmn2:targetRef>_19F79C80-D33E-45CC-A82F-F15871139096_ParameterInputX</bpmn2:targetRef>
</bpmn2:dataInputAssociation>
<bpmn2:dataOutputAssociation id="_hvyY9MNiEeSc-sL6266JgQ">
<bpmn2:sourceRef>_19F79C80-D33E-45CC-A82F-F15871139096_ResultOutputX</bpmn2:sourceRef>
<bpmn2:targetRef>output</bpmn2:targetRef>
</bpmn2:dataOutputAssociation>
</bpmn2:serviceTask>
<bpmn2:sequenceFlow id="_1C8728AD-4F67-452C-942B-25668B9FCB41" drools:bgcolor="#000000" drools:selectable="true" sourceRef="processStartEvent" targetRef="_19F79C80-D33E-45CC-A82F-F15871139096"/>
<bpmn2:endEvent id="_24673CA2-5D4F-43EE-A650-AEF3D334038A" drools:bgcolor="#ff6347" drools:selectable="true" name="">
<bpmn2:incoming>_5FB809EC-0CFE-49A1-848C-107A5D2B0FD1</bpmn2:incoming>
</bpmn2:endEvent>
<bpmn2:sequenceFlow id="_5FB809EC-0CFE-49A1-848C-107A5D2B0FD1" drools:bgcolor="#000000" drools:selectable="true" sourceRef="_19F79C80-D33E-45CC-A82F-F15871139096" targetRef="_24673CA2-5D4F-43EE-A650-AEF3D334038A"/>
</bpmn2:process>
<bpmndi:BPMNDiagram id="_hvzAAMNiEeSc-sL6266JgQ">
<bpmndi:BPMNPlane id="_hvzAAcNiEeSc-sL6266JgQ" bpmnElement="Project2.TestProcess2_project2">
<bpmndi:BPMNShape id="_hvzAAsNiEeSc-sL6266JgQ" bpmnElement="processStartEvent">
<dc:Bounds height="30.0" width="30.0" x="90.0" y="135.0"/>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="_hvzAA8NiEeSc-sL6266JgQ" bpmnElement="_19F79C80-D33E-45CC-A82F-F15871139096">
<dc:Bounds height="80.0" width="100.0" x="165.0" y="110.0"/>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="_hvzABMNiEeSc-sL6266JgQ" bpmnElement="_1C8728AD-4F67-452C-942B-25668B9FCB41">
<di:waypoint xsi:type="dc:Point" x="105.0" y="150.0"/>
<di:waypoint xsi:type="dc:Point" x="215.0" y="150.0"/>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="_hvzABcNiEeSc-sL6266JgQ" bpmnElement="_24673CA2-5D4F-43EE-A650-AEF3D334038A">
<dc:Bounds height="28.0" width="28.0" x="309.0" y="135.0"/>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="_hvzABsNiEeSc-sL6266JgQ" bpmnElement="_5FB809EC-0CFE-49A1-848C-107A5D2B0FD1">
<di:waypoint xsi:type="dc:Point" x="215.0" y="150.0"/>
<di:waypoint xsi:type="dc:Point" x="323.0" y="149.0"/>
</bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
<bpmn2:relationship id="_hvzAB8NiEeSc-sL6266JgQ" type="BPSimData">
<bpmn2:extensionElements>
<bpsim:BPSimData>
<bpsim:Scenario xsi:type="bpsim:Scenario" id="default" name="Simulationscenario">
<bpsim:ScenarioParameters xsi:type="bpsim:ScenarioParameters" baseTimeUnit="min"/>
<bpsim:ElementParameters xsi:type="bpsim:ElementParameters" elementRef="_19F79C80-D33E-45CC-A82F-F15871139096" id="_hvzACMNiEeSc-sL6266JgQ">
<bpsim:TimeParameters xsi:type="bpsim:TimeParameters">
<bpsim:ProcessingTime xsi:type="bpsim:Parameter">
<bpsim:UniformDistribution max="10.0" min="5.0"/>
</bpsim:ProcessingTime>
</bpsim:TimeParameters>
<bpsim:CostParameters xsi:type="bpsim:CostParameters">
<bpsim:UnitCost xsi:type="bpsim:Parameter">
<bpsim:FloatingParameter value="0.0"/>
</bpsim:UnitCost>
</bpsim:CostParameters>
</bpsim:ElementParameters>
<bpsim:ElementParameters xsi:type="bpsim:ElementParameters" elementRef="_5FB809EC-0CFE-49A1-848C-107A5D2B0FD1" id="_hvzACcNiEeSc-sL6266JgQ">
<bpsim:ControlParameters xsi:type="bpsim:ControlParameters">
<bpsim:Probability xsi:type="bpsim:Parameter">
<bpsim:FloatingParameter value="100.0"/>
</bpsim:Probability>
</bpsim:ControlParameters>
</bpsim:ElementParameters>
<bpsim:ElementParameters xsi:type="bpsim:ElementParameters" elementRef="processStartEvent" id="_hvzACsNiEeSc-sL6266JgQ">
<bpsim:TimeParameters xsi:type="bpsim:TimeParameters">
<bpsim:ProcessingTime xsi:type="bpsim:Parameter">
<bpsim:UniformDistribution max="10.0" min="5.0"/>
</bpsim:ProcessingTime>
</bpsim:TimeParameters>
<bpsim:ControlParameters xsi:type="bpsim:ControlParameters">
<bpsim:Probability xsi:type="bpsim:Parameter">
<bpsim:FloatingParameter value="100.0"/>
</bpsim:Probability>
</bpsim:ControlParameters>
</bpsim:ElementParameters>
<bpsim:ElementParameters xsi:type="bpsim:ElementParameters" elementRef="_24673CA2-5D4F-43EE-A650-AEF3D334038A" id="_hvzAC8NiEeSc-sL6266JgQ">
<bpsim:TimeParameters xsi:type="bpsim:TimeParameters">
<bpsim:ProcessingTime xsi:type="bpsim:Parameter">
<bpsim:UniformDistribution max="10.0" min="5.0"/>
</bpsim:ProcessingTime>
</bpsim:TimeParameters>
</bpsim:ElementParameters>
<bpsim:ElementParameters xsi:type="bpsim:ElementParameters" elementRef="_1C8728AD-4F67-452C-942B-25668B9FCB41" id="_hvzADMNiEeSc-sL6266JgQ">
<bpsim:ControlParameters xsi:type="bpsim:ControlParameters">
<bpsim:Probability xsi:type="bpsim:Parameter">
<bpsim:FloatingParameter value="100.0"/>
</bpsim:Probability>
</bpsim:ControlParameters>
</bpsim:ElementParameters>
</bpsim:Scenario>
</bpsim:BPSimData>
</bpmn2:extensionElements>
<bpmn2:source>_hvuukcNiEeSc-sL6266JgQ</bpmn2:source>
<bpmn2:target>_hvuukcNiEeSc-sL6266JgQ</bpmn2:target>
</bpmn2:relationship>
</bpmn2:definitions>
My "hello" method accept "String" as an input but while try to invoke that method from jbpm process why jbpm try to pass an java.lang.Object as an input?
how can I add "structureRef=String" for "bpmn2:inMessageRef"?
please correct me if I am doing anything wrong....