7 Replies Latest reply on Apr 27, 2011 5:49 AM by altoo2

    problem in ESB/JBPM exception handling

      i am encountering an problem in the esb using jbpm.

      i am using a bpm as simple as the bpm_orchestration1 sample, the bpm just take Esb service A, then to ESB service B, then to C.

      in ESB service A , i will throw an exception, in BPM definition, I use exceptionTransition, which will take exception to a exceptionHandler node.

      but the problem is , the exception happened in Service A will lead the workflow to the exceptionHandler node , but in this node, i can no longer get

      the exception infomation (message.getFault() is null).

      any hint that how i can get some info about the Exception i threw from Service A ? or how i can get the Exception ?

      thank you!

       

       

      the definition in bpm process definition:

       

      <node name="serviceA">

      <action

      class="org.jboss.soa.esb.services.jbpm.actionhandlers.EsbActionHandler">

      <esbServiceName>

      ServiceA

      </esbServiceName>

      <esbCategoryName>

      TEST

      </esbCategoryName>

      <bpmToEsbVars>

      <mapping bpm="theBody" esb="BODY_CONTENT"></mapping>

      </bpmToEsbVars>

      <esbToBpmVars>

      <mapping bpm="theBody" esb="BODY_CONTENT"></mapping>

      </esbToBpmVars>

      <exceptionTransition>exception</exceptionTransition>

      </action>

      <transition to="ServiceB"></transition>

      <transition to="exceptionHandler" name="exception"></transition>

       

      <node name="exceptionHandler">

      <action

      class="org.jboss.soa.esb.services.jbpm.actionhandlers.EsbActionHandler">

      <esbServiceName>

      ExceptionHandler

      </esbServiceName>

      <esbCategoryName>

      TEST

      </esbCategoryName>

      <bpmToEsbVars>

      <mapping bpm="theBody" esb="BODY_CONTENT"></mapping>

      </bpmToEsbVars>

      <esbToBpmVars>

      <mapping bpm="theBody" esb="BODY_CONTENT"></mapping>

      </esbToBpmVars>

      </action>

      <transition to="end"></transition>

      </node>

       

      </node>

        • 1. Re: problem in ESB/JBPM exception handling
          cammette

          you can't get any exception info in another jbpm node。

          if you need to do this,you should put the exception info to jbpm a variable,and in another jbpm node put the variable to esb.

          • 2. Re: problem in ESB/JBPM exception handling
            so I should use the exception handler mechanism which I can put the Exception in a variable , right ?
            • 3. Re: problem in ESB/JBPM exception handling
              cammette
              yes,you could add a custom action to put the exception info to the esb message body .
              • 4. Re: problem in ESB/JBPM exception handling

                but i have try many times ,still meet some problems

                1. the exception handler config only work for the Exception threw from the actionHandler Action ,right? but my Exception is threw from the Action of ESB service ,so I couldn't catch it.

                 

                2. I found the exception not only save in the Fault, but also in the "org.jboss.soa.esb.message.fault.throwable" field in Body.So I plan to transimit the Exception data to jbpm,then to esb again. but I met a new trouble, the config map is used MVEL, that means if I user

                <mapping><esb = "org.jboss.soa.esb.message.fault.throwable"  bpm="faultBody"></mapping> then it will try to get message.getBody().get("org").get("jboss").... is that right? hwo can I handle it?

                 

                can you explain me how can I fetch exception threw from esb action ? thank you very much

                • 5. Re: problem in ESB/JBPM exception handling
                  cammette

                  1. the exception handler config only work for the Exception threw from the actionHandler Action ,right? but my Exception is threw from the Action of ESB service ,so I couldn't catch it.

                  right.but you should catch EsbActionHandler‘exception,for example

                  <exception-handler exception-class="java.lang.Throwable">
                              <action class="xx.ProcessJbpmException">
                                  <transitionName>to process error
                              </transitionName>
                              </action>
                          </exception-handler>

                  ProcessJbpmException:
                          ec.getNode().leave(ec, transitionName);

                   

                  2. I found the exception not only save in the Fault, but also in the "org.jboss.soa.esb.message.fault.throwable" field in Body.So I plan to transimit the Exception data to jbpm,then to esb again. but I met a new trouble, the config map is used MVEL, that means if I user

                  <mapping><esb = "org.jboss.soa.esb.message.fault.throwable"  bpm="faultBody"></mapping> then it will try to get message.getBody().get("org").get("jboss").... is that right? hwo can I handle it?

                   

                  can you explain me how can I fetch exception threw from esb action ?


                  i also has tried many MVELs to put exception info to jbpm,but i failed.

                  at last,i added a custom action that processing the excepion to esb body'errorInfo in jbpm.esb/jboss-esb.xml,before

                  <action name="action" class="org.jboss.soa.esb.services.jbpm.actions.JBpmCallback" />

                  • 6. Re: problem in ESB/JBPM exception handling

                    ha ha, i finally handle the MVELs in the config, it has a escape char '\',if use this, then the MVEL will see it as a whole word.

                    use

                    <mapping><esb = "org\.jboss\.soa\.esb\.message\.fault\.throwable"  bpm="faultBody"></mapping>

                    then it done.

                    when threw a exception in the esb action, then this field will transimit to jbpm. then transimit to esb again, it worked.

                    hope this can help you.

                    • 7. Re: problem in ESB/JBPM exception handling
                      altoo2

                      aaa as:

                       

                      Thank you, you saved my day!

                       

                       

                       

                                  <esbToBpmVars>

                                      <mapping bpm="faultBody" esb = "org\.jboss\.soa\.esb\.message\.fault\.throwable" />

                                  </esbToBpmVars>

                      and later on

                       

                       

                       

                                  <bpmToEsbVars>

                                      <mapping bpm="faultBody" esb = "faultBody" />

                                  </bpmToEsbVars>