cancel
Showing results for 
Search instead for 
Did you mean: 

Error while deploying bpmn with service task

rahuldahiya
Champ in-the-making
Champ in-the-making
Hello,

I am trying to import a bpmn file, while deploying the bpm file i get following error

Error while parsing: One of the attributes 'class','delegateExpression','type','operation' or 'expression' is mendatory on service task.

Below is my BPMN file :


<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:activiti="http://activiti.org/bpmn" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:omgdc="http://www.omg.org/spec/DD/20100524/DC" xmlns:omgdi="http://www.omg.org/spec/DD/20100524/DI" typeLanguage="http://www.w3.org/2001/XMLSchema" expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://www.activiti.org/test">
  <process id="myProcess" name="My process" isExecutable="true">
    <startEvent id="startevent1" name="Start"></startEvent>
    <serviceTask id="servicetask1" name="Service Task" activiti:type="shell">
  <extensionElements>
    <activiti:field name="command" stringValue="echo" />
    <activiti:field name="arg1" stringValue="EchoTest" />
    <activiti:field name="arg2" stringValue="echo" />
    <activiti:field name="arg3" stringValue="EchoTest" />
    <activiti:field name="wait" stringValue="true" />
    <activiti:field name="outputVariable" stringValue="resultVar"/>
  </extensionElements>
    </serviceTask>
    <endEvent id="endevent1" name="End"></endEvent>
    <sequenceFlow id="flow1" sourceRef="startevent1" targetRef="servicetask1"></sequenceFlow>
    <sequenceFlow id="flow2" sourceRef="servicetask1" targetRef="endevent1"></sequenceFlow>
  </process>
  <bpmndi:BPMNDiagram id="BPMNDiagram_myProcess">
    <bpmndi:BPMNPlane bpmnElement="myProcess" id="BPMNPlane_myProcess">
      <bpmndi:BPMNShape bpmnElement="startevent1" id="BPMNShape_startevent1">
        <omgdc:Bounds height="35.0" width="35.0" x="90.0" y="240.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="servicetask1" id="BPMNShape_servicetask1">
        <omgdc:Bounds height="171.0" width="161.0" x="360.0" y="160.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="endevent1" id="BPMNShape_endevent1">
        <omgdc:Bounds height="35.0" width="35.0" x="710.0" y="228.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNEdge bpmnElement="flow1" id="BPMNEdge_flow1">
        <omgdi:waypoint x="125.0" y="257.0"></omgdi:waypoint>
        <omgdi:waypoint x="360.0" y="245.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow2" id="BPMNEdge_flow2">
        <omgdi:waypoint x="521.0" y="245.0"></omgdi:waypoint>
        <omgdi:waypoint x="710.0" y="245.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
    </bpmndi:BPMNPlane>
  </bpmndi:BPMNDiagram>
</definitions>

In the documentation, in section 8.5.11. (Shell Task) I did everything the same way but it didn't work

http://www.activiti.org/userguide/index.html#bpmnShellTask

In one of the posts I've read that currently service tasks are not suported in import/export and that I will need to wrtie my own custom class which extends ShellTaskBehaviour class. I am also unable to locate the ShellTaskBehaviour class. Please specify the jar in which this class is present and how can I use it to write my custom shell task. here the link to that post :

http://forums.activiti.org/content/deplyoing-shell-servicetasks-doesnt-work

I would like to know how to execute my shell scripts using bpmn file. And if the import/export of service tasks is not currently supported then will it be implemented in the future releases and whats the best way to implement the shell tasks Smiley Happy

Any help is appreciated.

Cheers,
Rahul
2 REPLIES 2

trademak
Star Contributor
Star Contributor
Hi Rahul,

When you say, you are trying to import this BPMN file. Where are you trying to import it in exactly?

Best regards,

pmsevestre
Champ in-the-making
Champ in-the-making
In order to run shell commands or any potentially "long" activity, I usually model an human task assigned to a "system" group or user. You can then use a task listener that starts the desired command asynchronously. When the command finishes, it uses Activiti's api or rest to complete the task.