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

frederikherema1
Star Contributor
Star Contributor
Use "activiti:type" as attribute, since "type" is an activiti extension to BPMN and you've mapped the activiti-prefix to it's url (xmlns:activiti="http://activiti.org/bpmn").

dcs1
Champ in-the-making
Champ in-the-making
Thanks for reply.
As said in the Activiti user Guide 5.13 on the Shell example i first tried <serviceTask id="shellEcho" activiti:type="shell" >
with the activiti-prefix. It didn't work so i tried to use the type without the prefix which also didn't work and copied the second code here.
I also tried the activiti-prefix again seconds ago but the failure still exists. Other ideas?

Edit: I can upload it via manage->deployments->upload new and then it appears in processes-deployed process definitions but when i click start process it says:
<code>Warning! Could not execute shell command</code>
Something with missing rights? I have really no idea.

jbarrez
Star Contributor
Star Contributor
This is what is in our unit tests:

<code>
<serviceTask id="shellEcho" activiti:type="shell">
   <extensionElements>
    <activiti:field name="command" stringValue="echo" />
    <activiti:field name="arg1" stringValue="EchoTest" />
    <activiti:field name="outputVariable"  stringValue="resultVar" />
   </extensionElements>
  </serviceTask>
</code>

Looks pretty much the same as you have.

Is there any stacktrace you can see beyond the 'could not execute shell command'?

dcs1
Champ in-the-making
Champ in-the-making
Hello again,
here is the last code i tried, which is now exactly the same:
<blockcode>
<?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="Shell_Task_Test" name="Shell Task Test" isExecutable="true">
    <startEvent id="start"></startEvent>
    <sequenceFlow id="sequenceFlow1" sourceRef="start" targetRef="shellEcho"></sequenceFlow>
    <serviceTask id="shellEcho" activiti:type="shell">
   <extensionElements>
    <activiti:field name="command" stringValue="echo" />
    <activiti:field name="arg1" stringValue="EchoTest" />
    <activiti:field name="outputVariable"  stringValue="resultVar" />
   </extensionElements>
  </serviceTask>   
    <endEvent id="end"></endEvent>
    <sequenceFlow id="sequenceFlow2" sourceRef="shellEcho" targetRef="end"></sequenceFlow>
  </process>
  <bpmndi:BPMNDiagram id="BPMNDiagram_Shell_Task_Test">
    <bpmndi:BPMNPlane bpmnElement="Shell_Task_Test" id="BPMNPlane_Shell_Task_Test">
      <bpmndi:BPMNShape bpmnElement="start" id="BPMNShape_start">
        <omgdc:Bounds height="30.0" width="30.0" x="0.0" y="15.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="shellEcho" id="BPMNShape_userTask1">
        <omgdc:Bounds height="60.0" width="100.0" x="80.0" y="0.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="end" id="BPMNShape_end">
        <omgdc:Bounds height="30.0" width="30.0" x="230.0" y="15.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNEdge bpmnElement="sequenceFlow1" id="BPMNEdge_sequenceFlow1">
        <omgdi:waypoint x="30.0" y="30.0"></omgdi:waypoint>
        <omgdi:waypoint x="42.0" y="30.0"></omgdi:waypoint>
        <omgdi:waypoint x="42.0" y="30.000000000000007"></omgdi:waypoint>
        <omgdi:waypoint x="80.0" y="30.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="sequenceFlow2" id="BPMNEdge_sequenceFlow2">
        <omgdi:waypoint x="180.0" y="30.0"></omgdi:waypoint>
        <omgdi:waypoint x="192.0" y="30.0"></omgdi:waypoint>
        <omgdi:waypoint x="192.0" y="30.000000000000004"></omgdi:waypoint>
        <omgdi:waypoint x="230.0" y="30.000000000000004"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
    </bpmndi:BPMNPlane>
  </bpmndi:BPMNDiagram>
</definitions>
</blockcode>

And the found logfile:
<code>
04:38:53,688 [http-apr-8080-exec-3] INFO  org.activiti.engine.impl.bpmn.deployer
.BpmnDeployer  - Processing resource Shell Task Test.bpmn20.xml
org.activiti.engine.ActivitiException: Errors while parsing:
One of the attributes 'class', 'delegateExpression', 'type', 'operation', or 'ex
pression' is mandatory on serviceTask. | shellEcho | line 6 | column 60
        at org.activiti.engine.impl.bpmn.parser.BpmnParse.execute(BpmnParse.java:205)
        at org.activiti.engine.impl.bpmn.deployer.BpmnDeployer.deploy(BpmnDeployer.java:86)
        at org.activiti.engine.impl.persistence.deploy.DeploymentManager.deploy(DeploymentManager.java:42)
        at org.activiti.engine.impl.cmd.DeployCmd.execute(DeployCmd.java:68)
        at org.activiti.engine.impl.cmd.DeployCmd.execute(DeployCmd.java:33)
        at org.activiti.engine.impl.interceptor.CommandExecutorImpl.execute(CommandExecutorImpl.java:24)
        at org.activiti.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:61)
        at org.activiti.spring.SpringTransactionInterceptor$1.doInTransaction(SpringTransactionInterceptor.java:42)
        at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:130)
        at org.activiti.spring.SpringTransactionInterceptor.execute(SpringTransactionInterceptor.java:40)
        at org.activiti.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:31)
        at org.activiti.engine.impl.RepositoryServiceImpl.deploy(RepositoryServiceImpl.java:74)
        at org.activiti.engine.impl.repository.DeploymentBuilderImpl.deploy(DeploymentBuilderImpl.java:134)
        at org.activiti.editor.ui.EditorProcessDefinitionDetailPanel.deployModelerModel(EditorProcessDefinitionDetailPanel.java:348)
        at org.activiti.editor.ui.EditorProcessDefinitionDetailPanel.deployModel(EditorProcessDefinitionDetailPanel.java:278)
        at org.activiti.editor.ui.EditorProcessDefinitionDetailPanel$1.valueChange(EditorProcessDefinitionDetailPanel.java:163)
        at sun.reflect.GeneratedMethodAccessor287.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at com.vaadin.event.ListenerMethod.receiveEvent(ListenerMethod.java:510)
        at com.vaadin.event.EventRouter.fireEvent(EventRouter.java:164)
        at com.vaadin.ui.AbstractComponent.fireEvent(AbstractComponent.java:1219)
        at com.vaadin.ui.AbstractField.fireValueChange(AbstractField.java:897)
        at com.vaadin.ui.AbstractField.setValue(AbstractField.java:529)
        at com.vaadin.ui.AbstractSelect.setValue(AbstractSelect.java:676)
        at com.vaadin.ui.Select.changeVariables(Select.java:664)
        at com.vaadin.terminal.gwt.server.AbstractCommunicationManager.changeVariables(AbstractCommunicationManager.java:1460)
        at com.vaadin.terminal.gwt.server.AbstractCommunicationManager.handleVariableBurst(AbstractCommunicationManager.java:1404)
        at com.vaadin.terminal.gwt.server.AbstractCommunicationManager.handleVariables(AbstractCommunicationManager.java:1329)
        at com.vaadin.terminal.gwt.server.AbstractCommunicationManager.doHandleUidlRequest(AbstractCommunicationManager.java:761)
        at com.vaadin.terminal.gwt.server.CommunicationManager.handleUidlRequest(CommunicationManager.java:325)
        at com.vaadin.terminal.gwt.server.AbstractApplicationServlet.service(AbstractApplicationServlet.java:501)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
        at org.activiti.explorer.filter.ExplorerFilter.doFilter(ExplorerFilter.java:44)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
        at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
        at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
        at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1023)
        at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
        at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:1852)
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
        at java.lang.Thread.run(Thread.java:662)
</code>

Do you see the problem?

dcs1
Champ in-the-making
Champ in-the-making
I have tried it under a Windows 2008 VM with another Tomcat installation and could reproduce the failure under Activiti 5.13 and 5.12

jbarrez
Star Contributor
Star Contributor
I ran your process in a unit test and it just works fine. So it must be related to something on Tomcat…

Can you try to run it as a unit test and see what you get? (or as a main program)

jbarrez
Star Contributor
Star Contributor
<code> Nonsense.</code>

wtf?

I took the process xml you posted above.Put it in a unit test. Executed it. And it runs fine.

frederikherema1
Star Contributor
Star Contributor
@dcs, Joram took the time to take your process definition, deploy and test it. Please have some respect for the people that are trying to help you.

The only thing I see that can be different, is the way it's deployed (through modeler rather than trough a unit-test). Have you tried deploying the process using a unit-test? Because that just works, as Joram just confirmed…

dcs1
Champ in-the-making
Champ in-the-making
Excuse me. You missunderstood my comment. I meant that i wrote nonsense in this post. I didn't see your last answer and made a post. After i saw your post my post was as said nonsense and explained myself, that i didn't see your post. My intention was so say, please delete my post.
Excuse me again i never wanted to be impolite.
I have a lot of respect for you both, who help so much people and take the time to find answers between your development.

I started my JAVA EE Eclipse Juno, installed Activiti and started a new project. I installed H2 and added an activiti-database with your create-scripts. Afterwards i added the bpmn-file you can see above and startet a UnitTest which was created over right-click->activit->generate unit test which runs in an error:

<code>
org.activiti.engine.ActivitiException: Could not execute shell command
at org.activiti.engine.impl.bpmn.behavior.ShellActivityBehavior.execute(ShellActivityBehavior.java:116)
at org.activiti.engine.impl.pvm.runtime.AtomicOperationActivityExecute.execute(AtomicOperationActivityExecute.java:44)
at org.activiti.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:87)
at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperationSync(ExecutionEntity.java:532)
at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:527)
300 more lines…
</code>

Hope this will help you.
I apologize the inconvenience of my last post again and hope you will answer again.

Regards
dcs