cancel
Showing results for 
Search instead for 
Did you mean: 

Deplyoing Shell-ServiceTasks doesn't work

dcs1
Champ in-the-making
Champ in-the-making
Hello everybody,

i am not very familiar with activiti so it may be a stupid question. I have installed Activiti 5.13 on a centOs-machine which has a TomCat6 and a mysql-database. I have change the configuration to work with the mysql-database. All other configuration-files have default values.
My first scenario is very simple, but doesn't work. I have Start -> ServiceTask(Shell) -> End. I tried to create it in the BPM Modeler and with the Designer in Eclipse. The Import works, but when i want to deploy it, it always says
Create of BPMN XML failed
Errors while parsing: One of the attributes 'class','delegateExpression','type','operation', or 'expression is mandatory on serviceTask.|servicetask1|line 5|column 83'


This is my bpmn-file:
<c><?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:activiti="http://activiti.org/bpmn" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlnsSmiley Surprisedmgdc="http://www.omg.org/spec/DD/20100524/DC" xmlnsSmiley Surprisedmgdi="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" type="shell">
      <extensionElements>
         <activiti:field name="command" stringValue="cmd" /> 
         <activiti:field name="arg1" stringValue="/c" /> 
         <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>
    <sequenceFlow id="flow1" sourceRef="startevent1" targetRef="servicetask1"></sequenceFlow>
    <endEvent id="endevent1" name="End"></endEvent>
    <sequenceFlow id="flow2" sourceRef="servicetask1" targetRef="endevent1"></sequenceFlow>
  </process>
  <bpmndi:BPMNDiagram id="BPMNDiagram_myProcess">
    <bpmndi:BPMNPlane bpmnElement="myProcess" id="BPMNPlane_myProcess">
      <bpmndi:BPMNShape bpmnElement="servicetask1" id="BPMNShape_servicetask1">
        <omgdc:Bounds height="55.0" width="105.0" x="550.0" y="230.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="startevent1" id="BPMNShape_startevent1">
        <omgdc:Bounds height="35.0" width="35.0" x="470.0" y="240.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="endevent1" id="BPMNShape_endevent1">
        <omgdc:Bounds height="35.0" width="35.0" x="710.0" y="240.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNEdge bpmnElement="flow1" id="BPMNEdge_flow1">
        <omgdi:waypoint x="505.0" y="257.0"></omgdi:waypoint>
        <omgdi:waypoint x="550.0" y="257.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow2" id="BPMNEdge_flow2">
        <omgdi:waypoint x="655.0" y="257.0"></omgdi:waypoint>
        <omgdi:waypoint x="710.0" y="257.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
    </bpmndi:BPMNPlane>
  </bpmndi:BPMNDiagram>
</definitions>
</c>

I did a lot of search on the Guide and the net, but couldn't find any solution for my problem. I hope you can help me.

Regards
dcs
22 REPLIES 22

Hi,

I am assuming that the shell scripts are executed via REST api.

I have the same requirement to execute unix shell scripts from Activiti .
As you have said it is working for you so it will be helpful for me if you could provide me with all the steps.

Also please let me know where the logs are visible which are shown above.

Thanks
Mohit

I am posting this as a roadmap for anyone else heading down the same path.
If you do want to use a Shell Task, first make sure you are familiar with section 8.5.11 of the user guide, then:
1. In activiti-explorer use the designer to create a service task, give it a class of something like: org.example.shellTask,
2. export it
3. use the text editor of you choice to edit the exported file and change 'activiti:class="org.example.shellTask"' to 'activiti:type="shell"
4. use REST api to create a new deployment (section 15.2.3 of the user guide)

However, we have since decided to use groovy to launch server side shells to connect to our legacy system. We made this decision because:
a) it allows us to capture both standard and error output in the script,
b) in some case we can combine two shell calls in the single script task,
c) in some cases we can combine a script task used to prepare values for the shell task, and the shell task into the single script task,
d) it is relatively fast, and
e) probably the most important, we avoid the awkward manual export, edit, deploy step

martin_grofcik
Confirmed Champ
Confirmed Champ
I already answered your question in another thread
org.activiti.examples.bpmn.shell.ShellTaskTest#testEchoShellLinux

Regards
Martin