execution.leaveNode() causes delegation exception
jcash Jul 6, 2006 3:22 AMI have moddeled a process that has a decision node in it. In the ActionHandler for the decision node, I use execution.leaveNode("transition") to leave the node. The problem is that although my process is followed and all the currect log statements are output (for debug) I get a delegation exception.
The process seams to work, and is followed, but the delegationexception happens after the process has enede.
Below is the code for my simplified decision action handler:
package uk.co.ifdsgroup.bpm.node; import org.apache.log4j.Logger; import org.jbpm.graph.def.ActionHandler; import org.jbpm.graph.exe.ExecutionContext; import uk.co.ifdsgroup.bpm.domain.Deal; public class CheckFund implements ActionHandler { private static final long serialVersionUID = 4860913349412363614L; private static final Logger logger = Logger.getLogger(CheckFund.class); public void execute(ExecutionContext execution) { //Get deal Deal deal = (Deal)execution.getVariable("Deal"); if(deal == null) { logger.error("No deal set on execution."); return; } //Get fund String fund = deal.getFund(); if(fund.startsWith("Euro")) { logger.debug("European Fund."); execution.leaveNode("Yes"); } else { logger.debug("UK Fund."); execution.leaveNode("No"); } } }
Below is a snippet from my log, including the successfull log statements:
16:40:58,868 [main] DEBUG GraphElement : event 'before-signal' on 'StartState(Start)' for 'Token(/)' 16:40:58,884 [main] DEBUG GraphElement : event 'node-leave' on 'StartState(Start)' for 'Token(/)' 16:40:58,884 [main] DEBUG GraphElement : event 'transition' on 'Transition(sale)' for 'Token(/)' 16:40:58,884 [main] DEBUG GraphElement : event 'node-enter' on 'Decision(Amount > 10,000 Euros)' for 'Token(/)' 16:40:58,884 [main] DEBUG GraphElement : executing action 'CheckAmount' 16:40:58,884 [main] DEBUG CheckAmount : No money laundering check required. 16:40:58,884 [main] DEBUG GraphElement : event 'node-leave' on 'Decision(Amount > 10,000 Euros)' for 'Token(/)' 16:40:58,884 [main] DEBUG GraphElement : event 'transition' on 'Transition(No)' for 'Token(/)' 16:40:58,900 [main] DEBUG GraphElement : event 'node-enter' on 'Decision(Invest in European Fund)' for 'Token(/)' 16:40:58,900 [main] DEBUG GraphElement : executing action 'CheckFund' 16:40:58,900 [main] DEBUG CheckFund : European Fund. 16:40:58,915 [main] DEBUG GraphElement : event 'node-leave' on 'Decision(Invest in European Fund)' for 'Token(/)' 16:40:58,915 [main] DEBUG GraphElement : event 'transition' on 'Transition(Yes)' for 'Token(/)' 16:40:58,915 [main] DEBUG GraphElement : event 'node-enter' on 'Node(Deal to iFAST)' for 'Token(/)' 16:40:58,915 [main] DEBUG GraphElement : executing action 'DealToIFast' 16:40:58,915 [main] DEBUG DealToIFast : Deal to iFAST. 16:40:58,915 [main] DEBUG VariableContainer : create variable 'success' in 'TokenVariableMap113a53d' with value 'true' 16:40:58,947 [main] DEBUG GraphElement : event 'node-leave' on 'Node(Deal to iFAST)' for 'Token(/)' 16:40:58,947 [main] DEBUG GraphElement : event 'transition' on 'Transition(check)' for 'Token(/)' 16:40:58,947 [main] DEBUG GraphElement : event 'node-enter' on 'Decision(Deal Successfull)' for 'Token(/)' 16:40:58,947 [main] DEBUG GraphElement : executing action 'CheckDealSuccessful' 16:40:58,947 [main] DEBUG CheckDealSuccessful : Deal Successful. 16:40:58,947 [main] DEBUG GraphElement : event 'node-leave' on 'Decision(Deal Successfull)' for 'Token(/)' 16:40:58,962 [main] DEBUG GraphElement : event 'transition' on 'Transition(Yes)' for 'Token(/)' 16:40:58,962 [main] DEBUG GraphElement : event 'node-enter' on 'Node(Issue Correspondance)' for 'Token(/)' 16:40:58,962 [main] DEBUG GraphElement : executing action 'IssueCorrespondence' 16:40:58,962 [main] DEBUG IssueCorrespondence : Issue Correspondence. 16:40:58,962 [main] DEBUG GraphElement : event 'node-leave' on 'Node(Issue Correspondance)' for 'Token(/)' 16:40:58,962 [main] DEBUG GraphElement : event 'transition' on 'Transition(success)' for 'Token(/)' 16:40:58,978 [main] DEBUG GraphElement : event 'node-enter' on 'EndState(Success)' for 'Token(/)' 16:40:58,978 [main] DEBUG GraphElement : event 'process-end' on 'ProcessDefinition(sale)' for 'Token(/)' 16:40:58,978 [main] ERROR GraphElement : action threw exception: null org.jbpm.graph.def.DelegationException at org.jbpm.graph.def.GraphElement.raiseException(GraphElement.java:349) at org.jbpm.graph.def.GraphElement.raiseException(GraphElement.java:343) at org.jbpm.graph.node.Decision.execute(Decision.java:130) at org.jbpm.graph.def.Node.enter(Node.java:316) at org.jbpm.graph.def.Transition.take(Transition.java:119) at org.jbpm.graph.def.Node.leave(Node.java:382) at org.jbpm.graph.def.Node.leave(Node.java:346) at org.jbpm.graph.def.Node.execute(Node.java:338) at org.jbpm.graph.def.Node.enter(Node.java:316) at org.jbpm.graph.def.Transition.take(Transition.java:119) at org.jbpm.graph.def.Node.leave(Node.java:382) at org.jbpm.graph.def.Node.leave(Node.java:357) at org.jbpm.graph.exe.ExecutionContext.leaveNode(ExecutionContext.java:128) at uk.co.ifdsgroup.bpm.node.CheckFund.execute(CheckFund.java:30) at org.jbpm.graph.def.Action.execute(Action.java:123) at org.jbpm.graph.def.GraphElement.executeAction(GraphElement.java:235) at org.jbpm.graph.def.GraphElement.executeActions(GraphElement.java:212) at org.jbpm.graph.def.GraphElement.fireAndPropagateEvent(GraphElement.java:182) at org.jbpm.graph.def.GraphElement.fireEvent(GraphElement.java:166) at org.jbpm.graph.def.Node.enter(Node.java:301) at org.jbpm.graph.def.Transition.take(Transition.java:119) at org.jbpm.graph.def.Node.leave(Node.java:382) at org.jbpm.graph.def.Node.leave(Node.java:357) at org.jbpm.graph.exe.ExecutionContext.leaveNode(ExecutionContext.java:128) at uk.co.ifdsgroup.bpm.node.CheckAmount.execute(CheckAmount.java:41) at org.jbpm.graph.def.Action.execute(Action.java:123) at org.jbpm.graph.def.GraphElement.executeAction(GraphElement.java:235) at org.jbpm.graph.def.GraphElement.executeActions(GraphElement.java:212) at org.jbpm.graph.def.GraphElement.fireAndPropagateEvent(GraphElement.java:182) at org.jbpm.graph.def.GraphElement.fireEvent(GraphElement.java:166) at org.jbpm.graph.def.Node.enter(Node.java:301) at org.jbpm.graph.def.Transition.take(Transition.java:119) at org.jbpm.graph.def.Node.leave(Node.java:382) at org.jbpm.graph.node.StartState.leave(StartState.java:70) at org.jbpm.graph.exe.Token.signal(Token.java:174) at org.jbpm.graph.exe.Token.signal(Token.java:123) at org.jbpm.graph.exe.ProcessInstance.signal(ProcessInstance.java:217) at uk.co.ifdsgroup.bpm.test.sale.SaleTest.testProcess(SaleTest.java:36) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at junit.framework.TestCase.runTest(TestCase.java:154) at junit.framework.TestCase.runBare(TestCase.java:127) at junit.framework.TestResult$1.protect(TestResult.java:106) at junit.framework.TestResult.runProtected(TestResult.java:124) at junit.framework.TestResult.run(TestResult.java:109) at junit.framework.TestCase.run(TestCase.java:118) at junit.framework.TestSuite.runTest(TestSuite.java:208) at junit.framework.TestSuite.run(TestSuite.java:203) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:478) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:344) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196) Caused by: java.lang.NullPointerException at org.jbpm.graph.node.Decision.execute(Decision.java:116) ... 50 more 16:40:58,993 [main] ERROR GraphElement : action threw exception: null org.jbpm.graph.def.DelegationException at org.jbpm.graph.def.GraphElement.raiseException(GraphElement.java:349) at org.jbpm.graph.def.GraphElement.raiseException(GraphElement.java:343) at org.jbpm.graph.def.GraphElement.executeAction(GraphElement.java:248) at org.jbpm.graph.def.GraphElement.executeActions(GraphElement.java:212) at org.jbpm.graph.def.GraphElement.fireAndPropagateEvent(GraphElement.java:182) at org.jbpm.graph.def.GraphElement.fireEvent(GraphElement.java:166) at org.jbpm.graph.def.Node.enter(Node.java:301) at org.jbpm.graph.def.Transition.take(Transition.java:119) at org.jbpm.graph.def.Node.leave(Node.java:382) at org.jbpm.graph.def.Node.leave(Node.java:357) at org.jbpm.graph.exe.ExecutionContext.leaveNode(ExecutionContext.java:128) at uk.co.ifdsgroup.bpm.node.CheckAmount.execute(CheckAmount.java:41) at org.jbpm.graph.def.Action.execute(Action.java:123) at org.jbpm.graph.def.GraphElement.executeAction(GraphElement.java:235) at org.jbpm.graph.def.GraphElement.executeActions(GraphElement.java:212) at org.jbpm.graph.def.GraphElement.fireAndPropagateEvent(GraphElement.java:182) at org.jbpm.graph.def.GraphElement.fireEvent(GraphElement.java:166) at org.jbpm.graph.def.Node.enter(Node.java:301) at org.jbpm.graph.def.Transition.take(Transition.java:119) at org.jbpm.graph.def.Node.leave(Node.java:382) at org.jbpm.graph.node.StartState.leave(StartState.java:70) at org.jbpm.graph.exe.Token.signal(Token.java:174) at org.jbpm.graph.exe.Token.signal(Token.java:123) at org.jbpm.graph.exe.ProcessInstance.signal(ProcessInstance.java:217) at uk.co.ifdsgroup.bpm.test.sale.SaleTest.testProcess(SaleTest.java:36) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at junit.framework.TestCase.runTest(TestCase.java:154) at junit.framework.TestCase.runBare(TestCase.java:127) at junit.framework.TestResult$1.protect(TestResult.java:106) at junit.framework.TestResult.runProtected(TestResult.java:124) at junit.framework.TestResult.run(TestResult.java:109) at junit.framework.TestCase.run(TestCase.java:118) at junit.framework.TestSuite.runTest(TestSuite.java:208) at junit.framework.TestSuite.run(TestSuite.java:203) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:478) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:344) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196) Caused by: org.jbpm.graph.def.DelegationException at org.jbpm.graph.def.GraphElement.raiseException(GraphElement.java:349) at org.jbpm.graph.def.GraphElement.raiseException(GraphElement.java:343) at org.jbpm.graph.node.Decision.execute(Decision.java:130) at org.jbpm.graph.def.Node.enter(Node.java:316) at org.jbpm.graph.def.Transition.take(Transition.java:119) at org.jbpm.graph.def.Node.leave(Node.java:382) at org.jbpm.graph.def.Node.leave(Node.java:346) at org.jbpm.graph.def.Node.execute(Node.java:338) at org.jbpm.graph.def.Node.enter(Node.java:316) at org.jbpm.graph.def.Transition.take(Transition.java:119) at org.jbpm.graph.def.Node.leave(Node.java:382) at org.jbpm.graph.def.Node.leave(Node.java:357) at org.jbpm.graph.exe.ExecutionContext.leaveNode(ExecutionContext.java:128) at uk.co.ifdsgroup.bpm.node.CheckFund.execute(CheckFund.java:30) at org.jbpm.graph.def.Action.execute(Action.java:123) at org.jbpm.graph.def.GraphElement.executeAction(GraphElement.java:235) ... 37 more Caused by: java.lang.NullPointerException at org.jbpm.graph.node.Decision.execute(Decision.java:116) ... 50 more
I hope someone can help.
Regards