cancel
Showing results for 
Search instead for 
Did you mean: 

Exclusive Gateway and 'Error while evaluating expression' errors

vve76
Champ in-the-making
Champ in-the-making
Hi!
I use Activiti 5.16.4. and try to  execute simple BP. There are two errors presents:
1. If I chose on User task1 form  at "accept1" field "Accept" chose, I follow  to the UserTask2 and it correct. If I choose reject - I follow to the ScriptTask and this correct too. But if I chose Reject, I follow to the ScriptTask instead of usertask_error. How I can make it correctly?
2.  On the UserTask2 I have form field par_1:

    <userTask id="usertask2" name="User Task2" activiti:assignee="kermit">
      <extensionElements>
        <activiti:formProperty id="par_1" name="param1" type="string" expression="${par1}"></activiti:formProperty>
      </extensionElements>
    </userTask>

It's receive content from field par1 of the UserTask1 correctly but when I try to finish task I get error message "Error while evaluating expression: ${par1}" and cannot continue executing BP. please, help me receive parameter correctly.
Cod is below:

<?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="VVE_1" name="VVE_1" isExecutable="true">
    <startEvent id="startevent1" name="Start">
      <extensionElements>
        <activiti:formProperty id="name1" name="name1" type="string"></activiti:formProperty>
        <activiti:formProperty id="name2" name="name2" type="string"></activiti:formProperty>
      </extensionElements>
    </startEvent>
    <userTask id="usertask1" name="User Task1" activiti:assignee="kermit">
      <extensionElements>
        <activiti:formProperty id="accept1" name="accept1" type="enum" required="true">
          <activiti:value id="true" name="Accept"></activiti:value>
          <activiti:value id="false" name="Reject"></activiti:value>
          <activiti:value id="error" name="Error"></activiti:value>
        </activiti:formProperty>
        <activiti:formProperty id="productName" name="Product Name - display Name" type="string"></activiti:formProperty>
        <activiti:formProperty id="par1" name="par1" type="string"></activiti:formProperty>
      </extensionElements>
    </userTask>
    <sequenceFlow id="flow1" sourceRef="startevent1" targetRef="usertask1"></sequenceFlow>
    <exclusiveGateway id="exclusivegateway1" name="Exclusive Gateway"></exclusiveGateway>
    <sequenceFlow id="flow2" sourceRef="usertask1" targetRef="exclusivegateway1"></sequenceFlow>
    <scriptTask id="scripttask1" name="Script Task" scriptFormat="groovy" activiti:autoStoreVariables="false">
      <script>out:println"\n===Order rejected due stock issues ==="</script>
    </scriptTask>
    <sequenceFlow id="flow3" sourceRef="exclusivegateway1" targetRef="scripttask1">
      <conditionExpression xsi:type="tFormalExpression"><![CDATA[${accept1==false}]]></conditionExpression>
    </sequenceFlow>
    <userTask id="usertask2" name="User Task2" activiti:assignee="kermit">
      <extensionElements>
        <activiti:formProperty id="par_1" name="param1" type="string" expression="${par1}"></activiti:formProperty>
      </extensionElements>
    </userTask>
    <sequenceFlow id="flow4" sourceRef="exclusivegateway1" targetRef="usertask2">
      <conditionExpression xsi:type="tFormalExpression"><![CDATA[${accept1==true}]]></conditionExpression>
    </sequenceFlow>
    <exclusiveGateway id="exclusivegateway2" name="Exclusive Gateway"></exclusiveGateway>
    <sequenceFlow id="flow5" sourceRef="usertask2" targetRef="exclusivegateway2"></sequenceFlow>
    <sequenceFlow id="flow6" sourceRef="scripttask1" targetRef="exclusivegateway2"></sequenceFlow>
    <userTask id="usertask3" name="User Task3" activiti:assignee="kermit"></userTask>
    <sequenceFlow id="flow7" sourceRef="exclusivegateway2" targetRef="usertask3"></sequenceFlow>
    <endEvent id="endevent1" name="End"></endEvent>
    <sequenceFlow id="flow8" sourceRef="usertask3" targetRef="endevent1"></sequenceFlow>
    <userTask id="usertask_error" name="User Task-Error"></userTask>
    <sequenceFlow id="flow9" sourceRef="exclusivegateway1" targetRef="usertask_error">
      <conditionExpression xsi:type="tFormalExpression"><![CDATA[${accept1==error}]]></conditionExpression>
    </sequenceFlow>
    <sequenceFlow id="flow10" sourceRef="usertask_error" targetRef="exclusivegateway2"></sequenceFlow>
  </process>
  <bpmndi:BPMNDiagram id="BPMNDiagram_VVE_1">
    <bpmndi:BPMNPlane bpmnElement="VVE_1" id="BPMNPlane_VVE_1">
      <bpmndi:BPMNShape bpmnElement="startevent1" id="BPMNShape_startevent1">
        <omgdc:Bounds height="35.0" width="35.0" x="60.0" y="160.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="usertask1" id="BPMNShape_usertask1">
        <omgdc:Bounds height="55.0" width="105.0" x="140.0" y="150.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="exclusivegateway1" id="BPMNShape_exclusivegateway1">
        <omgdc:Bounds height="40.0" width="40.0" x="290.0" y="158.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="scripttask1" id="BPMNShape_scripttask1">
        <omgdc:Bounds height="55.0" width="105.0" x="340.0" y="40.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="usertask2" id="BPMNShape_usertask2">
        <omgdc:Bounds height="55.0" width="105.0" x="341.0" y="280.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="exclusivegateway2" id="BPMNShape_exclusivegateway2">
        <omgdc:Bounds height="40.0" width="40.0" x="560.0" y="143.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="usertask3" id="BPMNShape_usertask3">
        <omgdc:Bounds height="55.0" width="105.0" x="645.0" y="136.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="endevent1" id="BPMNShape_endevent1">
        <omgdc:Bounds height="35.0" width="35.0" x="700.0" y="300.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="usertask_error" id="BPMNShape_usertask_error">
        <omgdc:Bounds height="55.0" width="105.0" x="332.0" y="400.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNEdge bpmnElement="flow1" id="BPMNEdge_flow1">
        <omgdi:waypoint x="95.0" y="177.0"></omgdi:waypoint>
        <omgdi:waypoint x="140.0" y="177.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow2" id="BPMNEdge_flow2">
        <omgdi:waypoint x="245.0" y="177.0"></omgdi:waypoint>
        <omgdi:waypoint x="290.0" y="178.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow3" id="BPMNEdge_flow3">
        <omgdi:waypoint x="310.0" y="158.0"></omgdi:waypoint>
        <omgdi:waypoint x="392.0" y="95.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow4" id="BPMNEdge_flow4">
        <omgdi:waypoint x="310.0" y="198.0"></omgdi:waypoint>
        <omgdi:waypoint x="393.0" y="280.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow5" id="BPMNEdge_flow5">
        <omgdi:waypoint x="393.0" y="280.0"></omgdi:waypoint>
        <omgdi:waypoint x="580.0" y="183.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow6" id="BPMNEdge_flow6">
        <omgdi:waypoint x="445.0" y="67.0"></omgdi:waypoint>
        <omgdi:waypoint x="580.0" y="67.0"></omgdi:waypoint>
        <omgdi:waypoint x="580.0" y="143.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow7" id="BPMNEdge_flow7">
        <omgdi:waypoint x="600.0" y="163.0"></omgdi:waypoint>
        <omgdi:waypoint x="645.0" y="163.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow8" id="BPMNEdge_flow8">
        <omgdi:waypoint x="697.0" y="191.0"></omgdi:waypoint>
        <omgdi:waypoint x="717.0" y="300.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow9" id="BPMNEdge_flow9">
        <omgdi:waypoint x="310.0" y="198.0"></omgdi:waypoint>
        <omgdi:waypoint x="384.0" y="400.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow10" id="BPMNEdge_flow10">
        <omgdi:waypoint x="437.0" y="427.0"></omgdi:waypoint>
        <omgdi:waypoint x="580.0" y="427.0"></omgdi:waypoint>
        <omgdi:waypoint x="580.0" y="183.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
    </bpmndi:BPMNPlane>
  </bpmndi:BPMNDiagram>
</definitions>
9 REPLIES 9

jbarrez
Star Contributor
Star Contributor
1. I believe you are missing quotes in your flow conditions. Now they are booleans and not strings.

2. That should work. Dont you have more stacktrace (in the server console) ?

vve76
Champ in-the-making
Champ in-the-making
Hi!
Big thanks for you answer. Question 1 have solved successfully. About question 2 I have error message:
<code>
╨╝╨░╤А 04, 2015 10:59:17 AM com.vaadin.Application terminalError
SEVERE: Terminal error:
com.vaadin.event.ListenerMethod$MethodException: Invocation of method buttonClic
k in org.activiti.explorer.ui.form.FormPropertiesForm$1 failed.
        at com.vaadin.event.ListenerMethod.receiveEvent(ListenerMethod.java:530)

        at com.vaadin.event.EventRouter.fireEvent(EventRouter.java:164)
        at com.vaadin.ui.AbstractComponent.fireEvent(AbstractComponent.java:1219
)
        at com.vaadin.ui.Button.fireClick(Button.java:567)
        at com.vaadin.ui.Button.changeVariables(Button.java:223)
        at com.vaadin.terminal.gwt.server.AbstractCommunicationManager.changeVar
iables(AbstractCommunicationManager.java:1460)
        at com.vaadin.terminal.gwt.server.AbstractCommunicationManager.handleVar
iableBurst(AbstractCommunicationManager.java:1404)
        at com.vaadin.terminal.gwt.server.AbstractCommunicationManager.handleVar
iables(AbstractCommunicationManager.java:1329)
        at com.vaadin.terminal.gwt.server.AbstractCommunicationManager.doHandleU
idlRequest(AbstractCommunicationManager.java:761)
        at com.vaadin.terminal.gwt.server.CommunicationManager.handleUidlRequest
(CommunicationManager.java:325)
        at com.vaadin.terminal.gwt.server.AbstractApplicationServlet.service(Abs
tractApplicationServlet.java:501)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:303)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:208)
        at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52
)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:241)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:208)
        at org.activiti.explorer.filter.ExplorerFilter.doFilter(ExplorerFilter.j
ava:44)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:241)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:208)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV
alve.java:220)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextV
alve.java:122)
        at org.apache.catalina.authenticator.AuthenticatorBase.invoke(Authentica
torBase.java:503)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j
ava:170)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j
ava:103)
        at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:
950)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal
ve.java:116)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.jav
a:421)
        at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp
11Processor.java:1070)
        at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(
AbstractProtocol.java:611)
        at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpo
int.java:2466)
        at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoin
t.java:2455)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.
java:1145)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor
.java:615)
        at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskTh
read.java:61)
        at java.lang.Thread.run(Thread.java:744)
Caused by: com.vaadin.event.ListenerMethod$MethodException: Invocation of method
componentEvent in org.activiti.explorer.ui.task.TaskDetailPanel$4 failed.
        at com.vaadin.event.ListenerMethod.receiveEvent(ListenerMethod.java:530)

        at com.vaadin.event.EventRouter.fireEvent(EventRouter.java:164)
        at com.vaadin.ui.AbstractComponent.fireEvent(AbstractComponent.java:1219
)
        at org.activiti.explorer.ui.form.FormPropertiesForm.access$000(FormPrope
rtiesForm.java:45)
        at org.activiti.explorer.ui.form.FormPropertiesForm$1.buttonClick(FormPr
opertiesForm.java:139)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at com.vaadin.event.ListenerMethod.receiveEvent(ListenerMethod.java:510)

        … 35 more
Caused by: org.activiti.engine.ActivitiException: Error while evaluating express
ion: ${par1}
        at org.activiti.engine.impl.el.JuelExpression.setValue(JuelExpression.ja
va:71)
        at org.activiti.engine.impl.form.FormPropertyHandler.submitFormProperty(
FormPropertyHandler.java:108)
        at org.activiti.engine.impl.form.DefaultFormHandler.submitFormProperties
(DefaultFormHandler.java:97)
        at org.activiti.engine.impl.cmd.SubmitTaskFormCmd.execute(SubmitTaskForm
Cmd.java:47)
        at org.activiti.engine.impl.cmd.NeedsActiveTaskCmd.execute(NeedsActiveTa
skCmd.java:59)
        at org.activiti.engine.impl.interceptor.CommandInvoker.execute(CommandIn
voker.java:24)
        at org.activiti.engine.impl.interceptor.CommandContextInterceptor.execut
e(CommandContextInterceptor.java:57)
        at org.activiti.spring.SpringTransactionInterceptor$1.doInTransaction(Sp
ringTransactionInterceptor.java:47)
        at org.springframework.transaction.support.TransactionTemplate.execute(T
ransactionTemplate.java:133)
        at org.activiti.spring.SpringTransactionInterceptor.execute(SpringTransa
ctionInterceptor.java:45)
        at org.activiti.engine.impl.interceptor.LogInterceptor.execute(LogInterc
eptor.java:31)
        at org.activiti.engine.impl.cfg.CommandExecutorImpl.execute(CommandExecu
torImpl.java:40)
        at org.activiti.engine.impl.cfg.CommandExecutorImpl.execute(CommandExecu
torImpl.java:35)
        at org.activiti.engine.impl.FormServiceImpl.submitTaskFormData(FormServi
ceImpl.java:70)
        at org.activiti.explorer.ui.task.TaskDetailPanel$4.handleFormSubmit(Task
DetailPanel.java:315)
        at org.activiti.explorer.ui.form.FormPropertiesEventListener.componentEv
ent(FormPropertiesEventListener.java:39)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at com.vaadin.event.ListenerMethod.receiveEvent(ListenerMethod.java:510)

        … 44 more
Caused by: org.activiti.engine.impl.javax.el.PropertyNotFoundException: Cannot r
esolve identifier 'par1'
        at org.activiti.engine.impl.juel.AstIdentifier.setValue(AstIdentifier.ja
va:97)
        at org.activiti.engine.impl.juel.AstEval.setValue(AstEval.java:86)
        at org.activiti.engine.impl.juel.TreeValueExpression.setValue(TreeValueE
xpression.java:138)
        at org.activiti.engine.impl.delegate.ExpressionSetInvocation.invoke(Expr
essionSetInvocation.java:37)
        at org.activiti.engine.impl.delegate.DelegateInvocation.proceed(Delegate
Invocation.java:37)
        at org.activiti.engine.impl.delegate.DefaultDelegateInterceptor.handleIn
vocation(DefaultDelegateInterceptor.java:25)
        at org.activiti.engine.impl.el.JuelExpression.setValue(JuelExpression.ja
va:67)
        … 64 more


</code>

trademak
Star Contributor
Star Contributor
The error message says that there's no process variable par1 available. Can you verify this?

Best regards,

shekhar_shaw
Champ in-the-making
Champ in-the-making
Hi..

I've mocked one BPMN model such that an email will be sent once user submits a form(user task using default Activiti form). I am getting the same buttonclick error.

I've explicitly stopped the SMTP server & trying to implement some error handling notification.

Can we catch the error at runtime using some boundary event or from Tasklistener ??

Thank you.

jbarrez
Star Contributor
Star Contributor
No, not with the current release. The 5.18 will have a mechanism to have async jobs map to bpmn errors.
For now, you can add your own ActivityBehaviour that extends from the MailActivityBehaviour, and catch the exception.

shekhar_shaw
Champ in-the-making
Champ in-the-making
Thank You !!!

smritishikha
Champ in-the-making
Champ in-the-making
i want to compare my variable value is less than or greater than some amount. what should i use script task or exclusive gateway..??
please help me in this I stuck up…

smritishikha
Champ in-the-making
Champ in-the-making
while using script task i put this in script task configuration

if(number<5){
var condition="true";}

else{
var condition="false";
}

and then using exclusive gateway to check whether the value of condition is true or false, but it shows that there is an unknown property used in the expression ${condition=="true"}
can you please help me in this

jbarrez
Star Contributor
Star Contributor
did you store the variable? ie. using execution.setVariable("condition", condition)