Thank you for the reply.
Actually here is the scenerio..
https://community.jboss.org/servlet/JiveServlet/downloadImage/2-751578-19136/450-153/processimage.jpg
Here, when node1 throws the exception, it should traverse through transition error.
Here is the processdefinition.xml
<?xml version="1.0" encoding="UTF-8"?>
<process-definition xmlns="urn:jbpm.org:jpdl-3.2" name="VitWork">
<start-state name="Start">
<transition to="node1"></transition>
</start-state>
<node name="node1" async="true">
<event type="node-leave">
<action class="com.sample.action.MessageActionHandler1"></action>
</event>
<transition to="node2" name="ok"></transition>
<transition to="Error Handling" name="error"></transition>
</node>
<node name="node2" async="true">
<event type="node-leave">
<action class="com.sample.action.MessageActionHandler2"></action>
</event>
<transition to="Approve"></transition>
</node>
<task-node name="Approve">
<task name="Approve"></task>
<transition to="end"></transition>
</task-node>
<task-node name="Error Handling">
<task name="Error Handling"></task>
<exception-handler exception-class="java.lang.Exception">
<action class="com.sample.exceptionHandler.ExceptionHandler"></action>
</exception-handler>
<transition to="end-state1"></transition>
</task-node>
<end-state name="end"></end-state>
<end-state name="end-state1"></end-state>
</process-definition>
Here is the MessageActionHandler1.java
package com.sample.action;
import org.jbpm.graph.def.ActionHandler;
import org.jbpm.graph.exe.ExecutionContext;
public class MessageActionHandler1 implements ActionHandler {
private static final long serialVersionUID = 1L;
public void execute(ExecutionContext context) throws Exception {
System.out.println("Thread 1 going to Sleep for 15 seconds...");
throw new Exception("Dummy Exception");
}
}