3 Replies Latest reply on Feb 21, 2011 11:09 PM by ffang

    Exception handling spring

    nohaapav

      Hi guys is somehow possible to get exception message from this doTry-doCatch block ?

       

      My scenario :

       

      which i found somewhere on camel pages but result is the same.

       

      Thanks for any help.

       

      Pavol

        • 1. Re: Exception handling spring
          davsclaus

          The caught exception is stored as a property on the Exchange. You can grab it using exchange.getProperty(Exchange.EXCEPTION_CAUGHT);

           

          Chapter 5 in the Camel book covers error handling very detailed. You may find information reading the Dead Letter Channel EIP

          http://fusesource.com/docs/router/2.5/eip/index.html

           

          Or scattered information at the Camel wiki pages

          http://camel.apache.org/error-handling-in-camel.html

           

          The EXCEPTION_CAUGHT works with bean binding, so just invoke a bean in the doCatch block and put a (Exception cause) in the method signature.

          • 2. Re: Exception handling spring
            nohaapav

            Now i tried to use something like :

             

             

             

            public class UnsupportedXmlSchema extends Exception {

             

            public final static Logger logger = LoggerFactory.getLogger(UnsupportedXmlSchema.class);

             

                public void unsupportedXmlSchema(Exception ex) {

                    logger.info(ex.getCause().toString());

                }

            }

             

            and works perfect so sorry for spam .. i'm a little bit overloaded seems to be ) .. and thanks of course ..

            • 3. Re: Exception handling spring
              ffang

              Hi Pavol,

               

              Just one note,

              If I understand correctly, this question is FUSE Mediation Router(Apache Camel) related only, but not FUSE Services Framework(Apache Cxf) related, would you please post such questions to correct forum category later on, it's better for track.

               

              Thanks

              Freeman