AnsweredAssumed Answered

Expression in Conditions throws PropertyNotFoundException Excetion

Question asked by diren on May 31, 2015
Latest reply on Jun 1, 2015 by diren
I am new to Activiti, so my appologies if this is just a simple beginners pebcak (problem exists between chair and keyboard). I played arround and searched the web without getting close to a solution, so I try this forum.

When doing a condition like ${doneLooping==true && check=="ok"}  I always get a 
org.activiti.engine.impl.javax.el.PropertyNotFoundException: Cannot resolve identifier 'doneLooping'

and the pretty stack trace that comes along with it. Even explicitly initialising the variables in a script task through
execution.setVariable("doneLooping", false)
did not change anything. The sample bpmn2 is below, any hints would be most appreciated!

Thanks, Diren.


<?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="myTest" name="My Test" isExecutable="true">
    <startEvent id="startevent1" name="Start"></startEvent>
    <endEvent id="endevent1" name="End"></endEvent>
    <userTask id="usertask1" name="First Task" activiti:assignee="kermit">
      <extensionElements>
        <activiti:formProperty id="userName" name="User Name" type="string" variable="assignee" default="kermit"></activiti:formProperty>
      </extensionElements>
    </userTask>
    <sequenceFlow id="flow1" sourceRef="exclusivegateway3" targetRef="usertask1"></sequenceFlow>
    <exclusiveGateway id="exclusivegateway1" name="Exclusive Gateway" default="flow4"></exclusiveGateway>
    <parallelGateway id="parallelgateway3" name="Parallel Gateway"></parallelGateway>
    <userTask id="usertask2" name="Loop Task" activiti:assignee="kermit">
      <extensionElements>
        <activiti:formProperty id="doneLooping" name="Done Looping?" type="boolean" variable="doneLooping" default="false"></activiti:formProperty>
        <activiti:formProperty id="loops" type="long" variable="loops" writable="false"></activiti:formProperty>
      </extensionElements>
    </userTask>
    <sequenceFlow id="flow2" sourceRef="exclusivegateway4" targetRef="usertask2"></sequenceFlow>
    <sequenceFlow id="flow3" sourceRef="usertask2" targetRef="exclusivegateway5"></sequenceFlow>
    <sequenceFlow id="flow4" sourceRef="exclusivegateway1" targetRef="exclusivegateway4"></sequenceFlow>
    <sequenceFlow id="flow5" sourceRef="exclusivegateway5" targetRef="parallelgateway3">
      <conditionExpression xsi:type="tFormalExpression"><![CDATA[${doneLooping==true}]]></conditionExpression>
    </sequenceFlow>
    <sequenceFlow id="loopAgain" sourceRef="exclusivegateway5" targetRef="scripttask2"></sequenceFlow>
    <userTask id="usertask3" name="Check Task" activiti:assignee="kermit">
      <extensionElements>
        <activiti:formProperty id="doneLooping" name="Done Looping" type="boolean" variable="doneLooping"></activiti:formProperty>
        <activiti:formProperty id="check" name="Check" type="enum" variable="check" required="true">
          <activiti:value id="ok" name="OK"></activiti:value>
          <activiti:value id="nok" name="NOK"></activiti:value>
        </activiti:formProperty>
      </extensionElements>
    </userTask>
    <exclusiveGateway id="exclusivegateway2" name="Exclusive Gateway"></exclusiveGateway>
    <sequenceFlow id="bypass" sourceRef="exclusivegateway1" targetRef="parallelgateway3">
      <conditionExpression xsi:type="tFormalExpression"><![CDATA[${doneLooping==true && check=="ok"}]]></conditionExpression>
    </sequenceFlow>
    <sequenceFlow id="flow8" sourceRef="usertask1" targetRef="exclusivegateway1"></sequenceFlow>
    <exclusiveGateway id="exclusivegateway3" name="Exclusive Gateway"></exclusiveGateway>
    <sequenceFlow id="flow9" sourceRef="scripttask1" targetRef="exclusivegateway3"></sequenceFlow>
    <sequenceFlow id="flow10" sourceRef="parallelgateway3" targetRef="usertask3"></sequenceFlow>
    <sequenceFlow id="flow11" sourceRef="usertask3" targetRef="exclusivegateway2"></sequenceFlow>
    <sequenceFlow id="flow12" sourceRef="exclusivegateway2" targetRef="exclusivegateway3"></sequenceFlow>
    <scriptTask id="scripttask1" name="Script Task" activiti:autoStoreVariables="false">
      <script>execution.setVariable("loops", 0)
execution.setVariable("doneLooping", false)</script>
    </scriptTask>
    <sequenceFlow id="flow13" sourceRef="startevent1" targetRef="scripttask1"></sequenceFlow>
    <scriptTask id="scripttask2" name="Loops++" activiti:autoStoreVariables="false">
      <script>execution.setVariable("loops", loops+1)</script>
    </scriptTask>
    <sequenceFlow id="flow14" sourceRef="scripttask2" targetRef="exclusivegateway4"></sequenceFlow>
    <sequenceFlow id="flow15" sourceRef="exclusivegateway2" targetRef="endevent1"></sequenceFlow>
    <exclusiveGateway id="exclusivegateway4" name="Parallel Gateway"></exclusiveGateway>
    <exclusiveGateway id="exclusivegateway5" name="Parallel Gateway" default="loopAgain"></exclusiveGateway>
  </process>
  <bpmndi:BPMNDiagram id="BPMNDiagram_myTest">
    <bpmndi:BPMNPlane bpmnElement="myTest" id="BPMNPlane_myTest">
      <bpmndi:BPMNShape bpmnElement="startevent1" id="BPMNShape_startevent1">
        <omgdc:Bounds height="35.0" width="35.0" x="300.0" y="291.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="endevent1" id="BPMNShape_endevent1">
        <omgdc:Bounds height="35.0" width="35.0" x="1406.0" y="290.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="usertask1" id="BPMNShape_usertask1">
        <omgdc:Bounds height="55.0" width="105.0" x="616.0" y="280.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="exclusivegateway1" id="BPMNShape_exclusivegateway1">
        <omgdc:Bounds height="40.0" width="40.0" x="766.0" y="287.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="parallelgateway3" id="BPMNShape_parallelgateway3">
        <omgdc:Bounds height="40.0" width="40.0" x="1136.0" y="287.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="usertask2" id="BPMNShape_usertask2">
        <omgdc:Bounds height="55.0" width="105.0" x="916.0" y="280.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="usertask3" id="BPMNShape_usertask3">
        <omgdc:Bounds height="55.0" width="105.0" x="1206.0" y="280.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="exclusivegateway2" id="BPMNShape_exclusivegateway2">
        <omgdc:Bounds height="40.0" width="40.0" x="1346.0" y="287.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="exclusivegateway3" id="BPMNShape_exclusivegateway3">
        <omgdc:Bounds height="40.0" width="40.0" x="546.0" y="288.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="scripttask1" id="BPMNShape_scripttask1">
        <omgdc:Bounds height="55.0" width="105.0" x="380.0" y="281.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="scripttask2" id="BPMNShape_scripttask2">
        <omgdc:Bounds height="55.0" width="105.0" x="916.0" y="150.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="exclusivegateway4" id="BPMNShape_exclusivegateway4">
        <omgdc:Bounds height="40.0" width="40.0" x="856.0" y="287.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="exclusivegateway5" id="BPMNShape_exclusivegateway5">
        <omgdc:Bounds height="40.0" width="40.0" x="1056.0" y="287.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNEdge bpmnElement="flow1" id="BPMNEdge_flow1">
        <omgdi:waypoint x="586.0" y="308.0"></omgdi:waypoint>
        <omgdi:waypoint x="616.0" y="307.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow2" id="BPMNEdge_flow2">
        <omgdi:waypoint x="896.0" y="307.0"></omgdi:waypoint>
        <omgdi:waypoint x="916.0" y="307.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow3" id="BPMNEdge_flow3">
        <omgdi:waypoint x="1021.0" y="307.0"></omgdi:waypoint>
        <omgdi:waypoint x="1056.0" y="307.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow4" id="BPMNEdge_flow4">
        <omgdi:waypoint x="806.0" y="307.0"></omgdi:waypoint>
        <omgdi:waypoint x="856.0" y="307.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow5" id="BPMNEdge_flow5">
        <omgdi:waypoint x="1096.0" y="307.0"></omgdi:waypoint>
        <omgdi:waypoint x="1136.0" y="307.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="loopAgain" id="BPMNEdge_loopAgain">
        <omgdi:waypoint x="1076.0" y="287.0"></omgdi:waypoint>
        <omgdi:waypoint x="1075.0" y="224.0"></omgdi:waypoint>
        <omgdi:waypoint x="1077.0" y="177.0"></omgdi:waypoint>
        <omgdi:waypoint x="1021.0" y="177.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="bypass" id="BPMNEdge_bypass">
        <omgdi:waypoint x="786.0" y="327.0"></omgdi:waypoint>
        <omgdi:waypoint x="785.0" y="369.0"></omgdi:waypoint>
        <omgdi:waypoint x="1156.0" y="369.0"></omgdi:waypoint>
        <omgdi:waypoint x="1156.0" y="327.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow8" id="BPMNEdge_flow8">
        <omgdi:waypoint x="721.0" y="307.0"></omgdi:waypoint>
        <omgdi:waypoint x="766.0" y="307.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow9" id="BPMNEdge_flow9">
        <omgdi:waypoint x="485.0" y="308.0"></omgdi:waypoint>
        <omgdi:waypoint x="546.0" y="308.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow10" id="BPMNEdge_flow10">
        <omgdi:waypoint x="1176.0" y="307.0"></omgdi:waypoint>
        <omgdi:waypoint x="1206.0" y="307.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow11" id="BPMNEdge_flow11">
        <omgdi:waypoint x="1311.0" y="307.0"></omgdi:waypoint>
        <omgdi:waypoint x="1346.0" y="307.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow12" id="BPMNEdge_flow12">
        <omgdi:waypoint x="1366.0" y="327.0"></omgdi:waypoint>
        <omgdi:waypoint x="1366.0" y="424.0"></omgdi:waypoint>
        <omgdi:waypoint x="993.0" y="424.0"></omgdi:waypoint>
        <omgdi:waypoint x="566.0" y="424.0"></omgdi:waypoint>
        <omgdi:waypoint x="566.0" y="328.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow13" id="BPMNEdge_flow13">
        <omgdi:waypoint x="335.0" y="308.0"></omgdi:waypoint>
        <omgdi:waypoint x="380.0" y="308.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow14" id="BPMNEdge_flow14">
        <omgdi:waypoint x="916.0" y="177.0"></omgdi:waypoint>
        <omgdi:waypoint x="876.0" y="178.0"></omgdi:waypoint>
        <omgdi:waypoint x="876.0" y="287.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow15" id="BPMNEdge_flow15">
        <omgdi:waypoint x="1386.0" y="307.0"></omgdi:waypoint>
        <omgdi:waypoint x="1406.0" y="307.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
    </bpmndi:BPMNPlane>
  </bpmndi:BPMNDiagram>
</definitions>
</xml>

Outcomes