3 Replies Latest reply on Aug 14, 2009 11:20 AM by kukeltje

    exception-handler with custom exception in jbpm 3.2.6

    massimo.zanette

      Hi,
      I'm not able to define an exeption-handler that handle Exception included inside the process archive. I'm using jbpm 3.2.6SP1 with jboss 5.0.1 and jboss 4.2.3.

      That's the problem:
      Using JBPM console I deploy a process archive with this process definition:

      <?xml version="1.0" encoding="UTF-8"?>
      <process-definition xmlns="urn:jbpm.org:jpdl-3.2" name="testException">
       <start-state name="start">
       <transition to="state1"></transition>
       <event type="node-leave">
       <script name="sysout">
       java.lang.System.out.println("---STARTING PROCESS testException--- ");
       </script>
       </event>
       </start-state>
       <state name="state1">
       <transition to="end-state">
       <action name="ThrowMyException" class="com.sample.action.ThrowMyExceptionActionHandler"></action>
       </transition>
       </state>
       <end-state name="end-state">
       <event type="node-enter">
       <script name="sysout">
       java.lang.System.out.println("---END PROCESS testException--- ");
       </script>
       </event>
       </end-state>
       <exception-handler exception-class="com.sample.action.MyException">
       <action name="exceptionHandler"
       class="com.sample.action.MyExceptionHandler">
       </action>
       </exception-handler>
      </process-definition>
      


      When the execution enter "state1" i can see that:
      - com.sample.action.ThrowMyExceptionActionHandler is entered
      - This action is empty, it only throws a com.sample.action.MyException-
      - com.sample.action.MyExceptionHandler is not reached and JBPMConsole report this error:

      Error signalling token: An exception of type "org.jbpm.JbpmException"
      was thrown. The message is: class not found 'com.sample.action.MyException'


      If i change the exception-class with java.lang.Exception inside the excpetion-handler the exception will be correctly caught and the process execution finish without problems.
      <exception-handler exception-class="java.lang.Exception">
       <action name="exceptionHandler"
       class="com.sample.action.MyExceptionHandler">
       </action>
       </exception-handler>
      


      I don't experience this problem if i try this process with a simple JUnit test case.
      Am i doing something wrong?
      Thanks

      Max