Uploaded image for project: 'JBRULES'
  1. JBRULES
  2. JBRULES-2783

ClassCastException when using Event node within ForEach node

    Details

      Description

      i'm using the latest version 5.1.1 of drools-flow for a POC project.

      I have a process definition where I have an intermediate event node within a foreach CompositeNode.
      When I trigger the event using processInstance.signalEvent() I get a ClassCastException:

      java.lang.ClassCastException: org.drools.workflow.core.node.CompositeContextNode cannot be cast to org.drools.workflow.core.node.EventNode
      at org.drools.workflow.instance.node.EventNodeInstance.getEventNode(EventNodeInstance.java:62)
      at org.drools.workflow.instance.node.EventNodeInstance.signalEvent(EventNodeInstance.java:36)
      at org.drools.workflow.instance.node.CompositeNodeInstance.signalEvent(CompositeNodeInstance.java:231)
      at org.drools.workflow.instance.impl.WorkflowProcessInstanceImpl.signalEvent(WorkflowProcessInstanceImpl.java:357)

      Below my process definition:

      <?xml version="1.0" encoding="UTF-8"?>
      <process xmlns="http://drools.org/drools-5.0/process"
      xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"
      xs:schemaLocation="http://drools.org/drools-5.0/process drools-processes-5.0.xsd"
      type="RuleFlow" name="flow" id="processOrders" package-name="order.flow" >

      <header>
      <variables>
      <variable name="orderPreparationResult" >
      <type name="org.drools.process.core.datatype.impl.type.UndefinedDataType" />
      </variable>
      <variable name="orders" >
      <type name="org.drools.process.core.datatype.impl.type.ObjectDataType" className="java.util.List" />
      </variable>
      </variables>
      </header>

      <nodes>
      <start id="1" name="Start" x="227" y="16" width="228" height="40" />
      <forEach id="2" name="ForEach" x="16" y="88" width="650" height="196" variableName="order" collectionExpression="orders" >
      <nodes>
      <eventNode id="2" name="OrderPreparation Response" x="146" y="133" width="166" height="40">
      <eventFilters>
      <eventFilter type="eventType" eventType="OrderPreparationEvent" />
      </eventFilters>
      </eventNode>
      <actionNode id="3" name="ORDER_PREP" x="9" y="53" width="151" height="50" >
      <action type="expression" dialect="java" >System.out.println("Call Order prep");</action>
      </actionNode>
      <join id="4" name="Join" x="191" y="59" width="80" height="40" type="1" />
      <actionNode id="5" name="ORDER_VALIDATION" x="300" y="56" width="141" height="40" >
      <action type="expression" dialect="java" >System.out.println("Order validation");</action>
      </actionNode>
      <actionNode id="6" name="POPULATE_DB" x="470" y="55" width="152" height="40" >
      <action type="expression" dialect="java" >System.out.println("Save to db");</action>
      </actionNode>
      </nodes>
      <connections>
      <connection from="3" to="4" />
      <connection from="2" to="4" />
      <connection from="4" to="5" />
      <connection from="5" to="6" />
      </connections>

      <in-ports>
      <in-port type="DROOLS_DEFAULT" nodeId="3" nodeInType="DROOLS_DEFAULT" />
      </in-ports>
      <out-ports>
      <out-port type="DROOLS_DEFAULT" nodeId="6" nodeOutType="DROOLS_DEFAULT" />
      </out-ports>
      </forEach>

      <end id="4" name="End" x="227" y="388" width="228" height="40" />
      <actionNode id="5" name="NOTIFY " x="288" y="316" width="106" height="40" >
      <action type="expression" dialect="java" >System.out.println("Notify");</action>
      </actionNode>
      </nodes>

      <connections>
      <connection from="1" to="2" />
      <connection from="5" to="4" />
      <connection from="2" to="5" />
      </connections>

      </process>

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  KrisVerlaenen Kris Verlaenen
                  Reporter:
                  jan.lisse Jan Lisse
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  0 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: