3 Replies Latest reply on Nov 6, 2015 3:56 PM by Rajiv Dadhich

    Signalling event to other process

    anthony_inovelan Newbie

      I'm doing some event experiments with Kie Drools Workbench and processes. Version = 6.1.0.Final

       

      I have a process like this, let's call it "process1" :

      event1.PNG

      And I have "process2" :

      event2.PNG

       

      So, I start "process1", "script1" is completed, and "process1" is paused because it waits for "Signal42".

      Then I start "process2" (different KieSession), and there's a WorkflowRuntimeException:

       

      14:35:38,117 WARN  [org.drools.persistence.SingleSessionCommandService] (default task-6) Could not commit session: org.jbpm.workflow.instance.WorkflowRuntimeException: [test.process1:9 904 - send signal 42:2] -- [Error: kcontext.getKnowledgeRuntime().signalEvent("Signal42", null): Unexpected exception executing action org.jbpm.process.instance.event.DefaultSignalManager$SignalAction@d37d763]

      [Near : {... kcontext.getKnowledgeRuntime() ....}]

                   ^

      [Line: 1, Column: 1]

          at org.jbpm.workflow.instance.impl.NodeInstanceImpl.executeAction(NodeInstanceImpl.java:195) [jbpm-flow-6.1.0.Final.jar:6.1.0.Final]

          at org.jbpm.workflow.instance.node.ActionNodeInstance.internalTrigger(ActionNodeInstance.java:48) [jbpm-flow-6.1.0.Final.jar:6.1.0.Final]

          at org.jbpm.workflow.instance.impl.NodeInstanceImpl.trigger(NodeInstanceImpl.java:162) [jbpm-flow-6.1.0.Final.jar:6.1.0.Final]

          at org.jbpm.workflow.instance.impl.NodeInstanceImpl.triggerNodeInstance(NodeInstanceImpl.java:354) [jbpm-flow-6.1.0.Final.jar:6.1.0.Final]

          at org.jbpm.workflow.instance.impl.NodeInstanceImpl.triggerCompleted(NodeInstanceImpl.java:313) [jbpm-flow-6.1.0.Final.jar:6.1.0.Final]

          at org.jbpm.workflow.instance.node.StartNodeInstance.triggerCompleted(StartNodeInstance.java:66) [jbpm-flow-6.1.0.Final.jar:6.1.0.Final]

          at org.jbpm.workflow.instance.node.StartNodeInstance.internalTrigger(StartNodeInstance.java:43) [jbpm-flow-6.1.0.Final.jar:6.1.0.Final]

          at org.jbpm.workflow.instance.impl.NodeInstanceImpl.trigger(NodeInstanceImpl.java:162) [jbpm-flow-6.1.0.Final.jar:6.1.0.Final]

          at org.jbpm.ruleflow.instance.RuleFlowProcessInstance.internalStart(RuleFlowProcessInstance.java:35) [jbpm-flow-6.1.0.Final.jar:6.1.0.Final]

          at org.jbpm.process.instance.impl.ProcessInstanceImpl.start(ProcessInstanceImpl.java:226) [jbpm-flow-6.1.0.Final.jar:6.1.0.Final]

          at org.jbpm.workflow.instance.impl.WorkflowProcessInstanceImpl.start(WorkflowProcessInstanceImpl.java:363) [jbpm-flow-6.1.0.Final.jar:6.1.0.Final]

          at org.jbpm.process.instance.ProcessRuntimeImpl.startProcessInstance(ProcessRuntimeImpl.java:187) [jbpm-flow-6.1.0.Final.jar:6.1.0.Final]

          at org.jbpm.process.instance.ProcessRuntimeImpl.startProcess(ProcessRuntimeImpl.java:169) [jbpm-flow-6.1.0.Final.jar:6.1.0.Final]

          at org.jbpm.process.instance.ProcessRuntimeImpl.startProcess(ProcessRuntimeImpl.java:161) [jbpm-flow-6.1.0.Final.jar:6.1.0.Final]

          at org.drools.core.impl.StatefulKnowledgeSessionImpl.startProcess(StatefulKnowledgeSessionImpl.java:1850) [drools-core-6.1.0.Final.jar:6.1.0.Final]

          at org.drools.core.command.runtime.process.StartProcessCommand.execute(StartProcessCommand.java:121) [drools-core-6.1.0.Final.jar:6.1.0.Final]

          at org.drools.core.command.runtime.process.StartProcessCommand.execute(StartProcessCommand.java:40) [drools-core-6.1.0.Final.jar:6.1.0.Final]

          at org.drools.core.command.impl.DefaultCommandService.execute(DefaultCommandService.java:36) [drools-core-6.1.0.Final.jar:6.1.0.Final]

          at org.drools.core.command.impl.AbstractInterceptor.executeNext(AbstractInterceptor.java:41) [drools-core-6.1.0.Final.jar:6.1.0.Final]

          at org.drools.persistence.SingleSessionCommandService$TransactionInterceptor.execute(SingleSessionCommandService.java:509) [drools-persistence-jpa-6.1.0.Final.jar:6.1.0.Final]

          at org.drools.persistence.SingleSessionCommandService.execute(SingleSessionCommandService.java:353) [drools-persistence-jpa-6.1.0.Final.jar:6.1.0.Final]

          at org.drools.core.command.impl.CommandBasedStatefulKnowledgeSession.startProcess(CommandBasedStatefulKnowledgeSession.java:230) [drools-core-6.1.0.Final.jar:6.1.0.Final]

          ...

      Caused by: [Error: kcontext.getKnowledgeRuntime().signalEvent("Signal42", null): Unexpected exception executing action org.jbpm.process.instance.event.DefaultSignalManager$SignalAction@d37d763]

      [Near : {... kcontext.getKnowledgeRuntime() ....}]

                   ^

      [Line: 1, Column: 1]

          at org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.compileGetChain(ReflectiveAccessorOptimizer.java:412) [mvel2-2.2.1.Final.jar:]

          at org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.optimizeAccessor(ReflectiveAccessorOptimizer.java:140) [mvel2-2.2.1.Final.jar:]

          at org.mvel2.ast.ASTNode.optimize(ASTNode.java:159) [mvel2-2.2.1.Final.jar:]

          at org.mvel2.ast.ASTNode.getReducedValueAccelerated(ASTNode.java:115) [mvel2-2.2.1.Final.jar:]

          at org.mvel2.compiler.ExecutableAccessor.getValue(ExecutableAccessor.java:42) [mvel2-2.2.1.Final.jar:]

          at org.mvel2.MVEL.executeExpression(MVEL.java:930) [mvel2-2.2.1.Final.jar:]

          at org.drools.core.util.MVELSafeHelper$RawMVELEvaluator.executeExpression(MVELSafeHelper.java:481) [drools-core-6.1.0.Final.jar:6.1.0.Final]

          at org.jbpm.process.instance.impl.MVELAction.execute(MVELAction.java:109) [jbpm-flow-6.1.0.Final.jar:6.1.0.Final]

          at org.jbpm.workflow.instance.impl.NodeInstanceImpl.executeAction(NodeInstanceImpl.java:189) [jbpm-flow-6.1.0.Final.jar:6.1.0.Final]

          ... 168 more

      Caused by: java.lang.reflect.InvocationTargetException

          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.8.0_31]

          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) [rt.jar:1.8.0_31]

          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.8.0_31]

          at java.lang.reflect.Method.invoke(Method.java:483) [rt.jar:1.8.0_31]

          at org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.getMethod(ReflectiveAccessorOptimizer.java:1097) [mvel2-2.2.1.Final.jar:]

          at org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.getMethod(ReflectiveAccessorOptimizer.java:980) [mvel2-2.2.1.Final.jar:]

          at org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.compileGetChain(ReflectiveAccessorOptimizer.java:373) [mvel2-2.2.1.Final.jar:]

          ... 176 more

      Caused by: java.lang.RuntimeException: Unexpected exception executing action org.jbpm.process.instance.event.DefaultSignalManager$SignalAction@d37d763

          at org.drools.core.impl.StatefulKnowledgeSessionImpl.executeQueuedActions(StatefulKnowledgeSessionImpl.java:1517) [drools-core-6.1.0.Final.jar:6.1.0.Final]

          at org.jbpm.process.instance.event.DefaultSignalManager.signalEvent(DefaultSignalManager.java:73) [jbpm-flow-6.1.0.Final.jar:6.1.0.Final]

          at org.jbpm.persistence.processinstance.JPASignalManager.signalEvent(JPASignalManager.java:37) [jbpm-persistence-jpa-6.1.0.Final.jar:6.1.0.Final]

          at org.jbpm.process.instance.ProcessRuntimeImpl.signalEvent(ProcessRuntimeImpl.java:441) [jbpm-flow-6.1.0.Final.jar:6.1.0.Final]

          at org.drools.core.impl.StatefulKnowledgeSessionImpl.signalEvent(StatefulKnowledgeSessionImpl.java:483) [drools-core-6.1.0.Final.jar:6.1.0.Final]

          ... 183 more

      Caused by: org.jbpm.workflow.instance.WorkflowRuntimeException: [test.process1:9 801 - end:5] -- Unknown node instance type: org.jbpm.workflow.instance.node.ActionNodeInstance@28625e6f

          at org.jbpm.workflow.instance.impl.NodeInstanceImpl.trigger(NodeInstanceImpl.java:168) [jbpm-flow-6.1.0.Final.jar:6.1.0.Final]

          at org.jbpm.workflow.instance.impl.NodeInstanceImpl.triggerNodeInstance(NodeInstanceImpl.java:354) [jbpm-flow-6.1.0.Final.jar:6.1.0.Final]

          at org.jbpm.workflow.instance.impl.NodeInstanceImpl.triggerCompleted(NodeInstanceImpl.java:313) [jbpm-flow-6.1.0.Final.jar:6.1.0.Final]

          at org.jbpm.workflow.instance.node.ActionNodeInstance.triggerCompleted(ActionNodeInstance.java:61) [jbpm-flow-6.1.0.Final.jar:6.1.0.Final]

          at org.jbpm.workflow.instance.node.ActionNodeInstance.internalTrigger(ActionNodeInstance.java:57) [jbpm-flow-6.1.0.Final.jar:6.1.0.Final]

          at org.jbpm.workflow.instance.impl.NodeInstanceImpl.trigger(NodeInstanceImpl.java:162) [jbpm-flow-6.1.0.Final.jar:6.1.0.Final]

          at org.jbpm.workflow.instance.impl.NodeInstanceImpl.triggerNodeInstance(NodeInstanceImpl.java:354) [jbpm-flow-6.1.0.Final.jar:6.1.0.Final]

          at org.jbpm.workflow.instance.impl.NodeInstanceImpl.triggerCompleted(NodeInstanceImpl.java:313) [jbpm-flow-6.1.0.Final.jar:6.1.0.Final]

          at org.jbpm.workflow.instance.impl.ExtendedNodeInstanceImpl.triggerCompleted(ExtendedNodeInstanceImpl.java:44) [jbpm-flow-6.1.0.Final.jar:6.1.0.Final]

          at org.jbpm.workflow.instance.node.EventNodeInstance.triggerCompleted(EventNodeInstance.java:73) [jbpm-flow-6.1.0.Final.jar:6.1.0.Final]

          at org.jbpm.workflow.instance.node.EventNodeInstance.signalEvent(EventNodeInstance.java:54) [jbpm-flow-6.1.0.Final.jar:6.1.0.Final]

          at org.jbpm.workflow.instance.impl.WorkflowProcessInstanceImpl.signalEvent(WorkflowProcessInstanceImpl.java:426) [jbpm-flow-6.1.0.Final.jar:6.1.0.Final]

          at org.jbpm.process.instance.event.DefaultSignalManager.internalSignalEvent(DefaultSignalManager.java:81) [jbpm-flow-6.1.0.Final.jar:6.1.0.Final]

          at org.jbpm.process.instance.event.DefaultSignalManager$SignalAction.execute(DefaultSignalManager.java:181) [jbpm-flow-6.1.0.Final.jar:6.1.0.Final]

          at org.drools.core.impl.StatefulKnowledgeSessionImpl.executeQueuedActions(StatefulKnowledgeSessionImpl.java:1515) [drools-core-6.1.0.Final.jar:6.1.0.Final]

          ... 187 more

      Caused by: java.lang.IllegalArgumentException: Unknown node instance type: org.jbpm.workflow.instance.node.ActionNodeInstance@28625e6f

          at org.jbpm.marshalling.impl.AbstractProtobufProcessInstanceMarshaller.writeNodeInstanceContent(AbstractProtobufProcessInstanceMarshaller.java:433) [jbpm-flow-6.1.0.Final.jar:6.1.0.Final]

          at org.jbpm.marshalling.impl.AbstractProtobufProcessInstanceMarshaller.writeNodeInstance(AbstractProtobufProcessInstanceMarshaller.java:167) [jbpm-flow-6.1.0.Final.jar:6.1.0.Final]

          at org.jbpm.marshalling.impl.AbstractProtobufProcessInstanceMarshaller.writeProcessInstance(AbstractProtobufProcessInstanceMarshaller.java:105) [jbpm-flow-6.1.0.Final.jar:6.1.0.Final]

          at org.jbpm.marshalling.impl.AbstractProtobufProcessInstanceMarshaller.writeProcessInstance(AbstractProtobufProcessInstanceMarshaller.java:62) [jbpm-flow-6.1.0.Final.jar:6.1.0.Final]

          at org.jbpm.persistence.processinstance.ProcessInstanceInfo.update(ProcessInstanceInfo.java:219) [jbpm-persistence-jpa-6.1.0.Final.jar:6.1.0.Final]

          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.8.0_31]

          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) [rt.jar:1.8.0_31]

          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.8.0_31]

          at java.lang.reflect.Method.invoke(Method.java:483) [rt.jar:1.8.0_31]

          at org.hibernate.jpa.event.internal.jpa.EntityCallback.performCallback(EntityCallback.java:47) [hibernate-entitymanager-4.3.7.Final.jar:4.3.7.Final]

          at org.hibernate.jpa.event.internal.jpa.CallbackRegistryImpl.callback(CallbackRegistryImpl.java:112) [hibernate-entitymanager-4.3.7.Final.jar:4.3.7.Final]

          at org.hibernate.jpa.event.internal.jpa.CallbackRegistryImpl.preUpdate(CallbackRegistryImpl.java:76) [hibernate-entitymanager-4.3.7.Final.jar:4.3.7.Final]

          at org.hibernate.jpa.event.internal.core.JpaFlushEntityEventListener.invokeInterceptor(JpaFlushEntityEventListener.java:67) [hibernate-entitymanager-4.3.7.Final.jar:4.3.7.Final]

          at org.hibernate.event.internal.DefaultFlushEntityEventListener.handleInterception(DefaultFlushEntityEventListener.java:342) [hibernate-core-4.3.7.Final.jar:4.3.7.Final]

          at org.hibernate.event.internal.DefaultFlushEntityEventListener.scheduleUpdate(DefaultFlushEntityEventListener.java:293) [hibernate-core-4.3.7.Final.jar:4.3.7.Final]

          at org.hibernate.event.internal.DefaultFlushEntityEventListener.onFlushEntity(DefaultFlushEntityEventListener.java:160) [hibernate-core-4.3.7.Final.jar:4.3.7.Final]

          at org.hibernate.event.internal.AbstractFlushingEventListener.flushEntities(AbstractFlushingEventListener.java:231) [hibernate-core-4.3.7.Final.jar:4.3.7.Final]

          at org.hibernate.event.internal.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:102) [hibernate-core-4.3.7.Final.jar:4.3.7.Final]

          at org.hibernate.event.internal.DefaultAutoFlushEventListener.onAutoFlush(DefaultAutoFlushEventListener.java:61) [hibernate-core-4.3.7.Final.jar:4.3.7.Final]

          at org.hibernate.internal.SessionImpl.autoFlushIfRequired(SessionImpl.java:1191) [hibernate-core-4.3.7.Final.jar:4.3.7.Final]

          at org.hibernate.internal.SessionImpl.list(SessionImpl.java:1257) [hibernate-core-4.3.7.Final.jar:4.3.7.Final]

          at org.hibernate.internal.QueryImpl.list(QueryImpl.java:103) [hibernate-core-4.3.7.Final.jar:4.3.7.Final]

          at org.hibernate.jpa.internal.QueryImpl.list(QueryImpl.java:573) [hibernate-entitymanager-4.3.7.Final.jar:4.3.7.Final]

          at org.hibernate.jpa.internal.QueryImpl.getResultList(QueryImpl.java:449) [hibernate-entitymanager-4.3.7.Final.jar:4.3.7.Final]

          at org.jbpm.persistence.JpaProcessPersistenceContext.remove(JpaProcessPersistenceContext.java:53) [jbpm-persistence-jpa-6.1.0.Final.jar:6.1.0.Final]

          at org.jbpm.persistence.processinstance.JPAProcessInstanceManager.removeProcessInstance(JPAProcessInstanceManager.java:153) [jbpm-persistence-jpa-6.1.0.Final.jar:6.1.0.Final]

          at org.jbpm.workflow.instance.impl.WorkflowProcessInstanceImpl.setState(WorkflowProcessInstanceImpl.java:292) [jbpm-flow-6.1.0.Final.jar:6.1.0.Final]

          at org.jbpm.workflow.instance.impl.WorkflowProcessInstanceImpl.setState(WorkflowProcessInstanceImpl.java:308) [jbpm-flow-6.1.0.Final.jar:6.1.0.Final]

          at org.jbpm.workflow.instance.node.EndNodeInstance.internalTrigger(EndNodeInstance.java:67) [jbpm-flow-6.1.0.Final.jar:6.1.0.Final]

          at org.jbpm.workflow.instance.impl.NodeInstanceImpl.trigger(NodeInstanceImpl.java:162) [jbpm-flow-6.1.0.Final.jar:6.1.0.Final]

          ... 201 more


      Here are some logs of the processes flows :

       

      beforeProcessStarted : test.process1

      beforeNodeTriggered : start

      beforeNodeLeft : start

      beforeNodeTriggered : script1

      "I am script 1"

      beforeNodeLeft : script1

      beforeNodeTriggered : catch signal 42

      afterNodeTriggered : catch signal 42

      afterNodeLeft : script1

      afterNodeTriggered : script1

      afterNodeLeft : start

      afterNodeTriggered : start

      afterProcessStarted : test.process1

       

      beforeProcessStarted : test.process2

      beforeNodeTriggered :

      beforeNodeLeft :

      beforeNodeTriggered : send signal 42

      beforeNodeLeft : catch signal 42

      beforeNodeTriggered : script2

      "I am script 2"

      beforeNodeLeft : script2

      beforeNodeTriggered : end

      beforeNodeLeft : end

      beforeProcessCompleted : test.process1

      ---> [here is the WorkflowRuntimeException]


      "script2" is executed but the node "script2" is not completed and the process "process1" is not completed either.

      "process2" isn't even persisted as a started process.


      Is it because I have two processes in two different sessions ?


      Thanks !