2 Replies Latest reply on Dec 3, 2009 7:47 AM by dcernahoschi

    exception handling with jpdl

    dcernahoschi

      How can I get the root cause exception when invoking a method from a jpdl pageflow? For example:


      <page name="invoiceItems" view-id="/documentItems.xhtml">
         <redirect/>
         <transition name="save" to="view">
           <action expression="#{expeditionMg.save()}"/>                                   
         </transition>
         <transition name="cancel" to="end"/>
      </page>



      In this case the save() method throws a OptimisticLockException, but the jbpm wraps and rethrows the exception as JbpmException having as cause a ELException.
      I've tried to catch it using the following:


      <exception-handler exception-class="org.jbpm.JbpmException">
           <action class="com.gradientis.sombrero.JbpmExceptionHandler"/>
       </exception-handler>



      but I can't get to the root exception. Is there a way to catch the OptimisticLockException that I need ?

        • 1. Re: exception handling with jpdl
          kukeltje.ronald.jbpm.org

          I'm not sure, but afair some things have changed in this area in later jBPM version. You might give 3.2.6sp1 or 7 or 8 a try. Should be dropin replacements for the one that comes with Seam

          • 2. Re: exception handling with jpdl
            dcernahoschi

            Thank you, but it doesn't work.


            It seems that the only way to deal with the orginal exception is to catch it right in the save() method and than to use a decision node in the pageflow. Something like this:



            try {
               em.flush();
               versioningProblem = false;
            }catch(OptimisticLockException e) {
               versioningProblem = true;
            }
            
            <decision name="decisionOnSave" expression="#{expeditionMg.isVersioningProblem()}">
                <transition name="true" to="error"/>
                <transition name="false" to="view"/>
            </decision>