0 Replies Latest reply on Sep 2, 2011 8:43 AM by Greg Davidson

    onException and UnresolvedAddressException not working

    Greg Davidson Newbie

      I have set up some exception handling, it works fine, except when I provide a "bad" URL to the @RecipientList, from a bean route.  The  catches the the exception (java.nio.channels.UnresolvedAddressException) just fine.  In the bean (httpConnectionExceptionProcessor)  I format a message to be returned, however that message is not returned, the following exception is returned.  So far all other exceptions are handled fine....I can format a response, which gets back to the client...it's only  when I provide a bad URL from the bean route...the exception is returned.  I need to be able to format a specialized message....but the message I add to the exchange is never returned in this one case.....only the exception is returned.

       

      EXCEPTION RETURNED

      java.lang.IllegalStateException: DISPATCHED,initial

           at org.eclipse.jetty.server.AsyncContinuation.dispatch(AsyncContinuation.java:364)

           at org.eclipse.jetty.server.AsyncContinuation.resume(AsyncContinuation.java:769)

           at org.apache.camel.component.jetty.CamelContinuationServlet$1.done(CamelContinuationServlet.java:85)

           at org.apache.camel.management.InstrumentationProcessor$1.done(InstrumentationProcessor.java:78)

           at org.apache.camel.processor.UnitOfWorkProcessor$1.done(UnitOfWorkProcessor.java:104)

           at org.apache.camel.processor.Pipeline$1.done(Pipeline.java:194)

           at org.apache.camel.processor.DefaultChannel$1.done(DefaultChannel.java:262)

           at org.apache.camel.processor.RedeliveryErrorHandler$1.done(RedeliveryErrorHandler.java:302)

           at org.apache.camel.management.InstrumentationProcessor$1.done(InstrumentationProcessor.java:78)

           at org.apache.camel.management.InstrumentationProcessor$1.done(InstrumentationProcessor.java:78)

           at org.apache.camel.processor.MulticastProcessor.doDone(MulticastProcessor.java:490)

           at org.apache.camel.processor.MulticastProcessor$2.done(MulticastProcessor.java:407)

           at org.apache.camel.processor.RedeliveryErrorHandler$2.done(RedeliveryErrorHandler.java:595)

           at org.apache.camel.processor.DefaultChannel$1.done(DefaultChannel.java:262)

           at org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:321)

           at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:202)

           at org.apache.camel.processor.DefaultChannel.process(DefaultChannel.java:256)

           at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:70)

           at org.apache.camel.processor.RedeliveryErrorHandler.deliverToFailureProcessor(RedeliveryErrorHandler.java:582)

           at org.apache.camel.processor.RedeliveryErrorHandler.processAsyncErrorHandler(RedeliveryErrorHandler.java:359)

           at org.apache.camel.processor.RedeliveryErrorHandler$1.done(RedeliveryErrorHandler.java:308)

           at org.apache.camel.component.jetty.JettyContentExchange.doTaskCompleted(JettyContentExchange.java:195)

           at org.apache.camel.component.jetty.JettyContentExchange.onConnectionFailed(JettyContentExchange.java:116)

           at org.eclipse.jetty.client.HttpExchange$Listener.onConnectionFailed(HttpExchange.java:822)

           at org.eclipse.jetty.client.HttpDestination.onConnectionFailed(HttpDestination.java:274)

           at org.eclipse.jetty.client.HttpDestination.startNewConnection(HttpDestination.java:254)

           at org.eclipse.jetty.client.HttpDestination.doSend(HttpDestination.java:501)

           at org.eclipse.jetty.client.HttpDestination.send(HttpDestination.java:450)

           at org.eclipse.jetty.client.HttpClient.send(HttpClient.java:148)

           at org.apache.camel.component.jetty.JettyHttpProducer.doSendExchange(JettyHttpProducer.java:168)

           at org.apache.camel.component.jetty.JettyHttpProducer.process(JettyHttpProducer.java:70)

           at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:70)

           at org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:290)

           at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:202)

           at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:70)

           at org.apache.camel.processor.MulticastProcessor.doProcessSequential(MulticastProcessor.java:334)

           at org.apache.camel.processor.MulticastProcessor.doProcessSequential(MulticastProcessor.java:274)

           at org.apache.camel.processor.MulticastProcessor.process(MulticastProcessor.java:179)

           at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:70)

           at org.apache.camel.processor.RecipientList.sendToRecipientList(RecipientList.java:113)

           at org.apache.camel.component.bean.MethodInfo$1.proceed(MethodInfo.java:170)

           at org.apache.camel.component.bean.BeanProcessor.process(BeanProcessor.java:159)

           at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:70)

           at org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:98)

           at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:89)

           at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:68)

           at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:70)

           at org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:98)

           at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:89)

           at org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:174)

           at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:70)

           at org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:98)

           at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:89)

           at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:68)

           at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:70)

           at org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:290)

           at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:202)

           at org.apache.camel.processor.DefaultChannel.process(DefaultChannel.java:256)

           at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:70)

           at org.apache.camel.processor.Pipeline.process(Pipeline.java:143)

           at org.apache.camel.processor.Pipeline.process(Pipeline.java:78)

           at org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:99)

           at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:70)

           at org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:98)

           at org.apa

       

       

       

       

      Spring configuration:

       

           <camel:routeContext id="httpRoute">

                <camel:route id="HTTP_WS_PROXY" handleFault="false">

                     <camel:from uri="jetty:http://0.0.0.0:9091?matchOnUriPrefix=true" />

                           

                          <camel:bean method="route" ref="httpServiceRouter" />

       

                 

           <bean id="httpConnectionExceptionProcessor" class="com.in.exception.ConnectionExceptionProcessor"></bean>

       

       

                     <camel:exception>java.nio.channels.UnresolvedAddressException</camel:exception>     

                     <camel:handled><camel:constant>true</camel:constant></camel:handled>

                     <camel:process ref="httpConnectionExceptionProcessor"/>

                </camel:onException>

                <camel:onException>

                     <camel:exception>java.lang.Exception</camel:exception>

                     <camel:handled><camel:constant>true</camel:constant></camel:handled>

                     <camel:process ref="httpDefaultExceptionProcessor"/>               

                </camel:onException>

           </camelContext>

       

       

      JAVA:

      (httpServiceRouter) router code:

           @RecipientList

           public String[] route (     ){

                return new String[] {"jetty:http://DEV-SERVERxxxx1:9081/services/Decoder?bridgeEndpoint=true"};

           }

       

      (httpConnectionExceptionProcessor) exception handler code

           @Override

           public void process(Exchange exchange) throws Exception {

                final String returnMesg = this.getXmlStringResponse("T-0100", "Technical exception");

                exchange.getIn().setBody(returnMesg);               

           }

       

      Edited by: gmdavidson62 on Sep 2, 2011 8:39 AM

       

      Edited by: gmdavidson62 on Sep 2, 2011 8:41 AM

       

      Edited by: gmdavidson62 on Sep 2, 2011 8:43 AM