The issue is resolved after I added the below line in camelconetxt.xml file
<bean id="http" class="org.apache.camel.component.http.HttpComponent">

cheers
gnanda


gnanda wrote:
> 
> I have attached my routercode. as an attachment
> For convenience few lines are here
>  
> onException(org.apache.camel.component.http.HttpOperationFailedException.class).handled(true).to("jms:queue:MM.HTTP-ERRORQ");
>       onException(Exception.class).onWhen(new Predicate() {
> 
>                       public boolean matches(Exchange exchange) {
>                               log.info(exchange);
> 
>                               Exception ex = 
> exchange.getProperty(Exchange.EXCEPTION_CAUGHT,
>                                               Exception.class);
>                               
> org.apache.camel.component.http.HttpOperationFailedException ex1 =
> exchange.getProperty(Exchange.EXCEPTION_CAUGHT,
>                                               
> org.apache.camel.component.http.HttpOperationFailedException.class);
>                               log.info("HttpOperatioFailedException is:"+ex1);
>                               
>                               if(ex instanceof
> org.apache.camel.component.http.HttpOperationFailedException){
>                                       log.info("exception is instanceof
> http.HttpOperationFailedException");
>                                       
> org.apache.camel.component.http.HttpOperationFailedException ex2
> =(org.apache.camel.component.http.HttpOperationFailedException)ex;
>                                       log.info("response body is:"+ 
> ex2.getResponseBody());
>                               }
>                               else{
>                                       log.info("exception is NOT instanceof
> http.HttpOperationFailedException");
>                               }
>                               if(ex instanceof 
> org.apache.camel.RuntimeCamelException){
>                                       log.info("exception is instanceof
> org.apache.camel.RuntimeCamelException");
>                                       
>                               }
>                               else{
>                                       log.info("exception is NOT instanceof
> org.apache.camel.RuntimeCamelException");
>                               }
>                               log.info("EXCEPTION CLASS IS:"+ex.getClass());
>                               log.info("EXCEPTION CAUSE IS:"+ex.getCause());
> 
>                               log.error(ex);
>                               log.error("error:",ex);
>                               ex.printStackTrace();
>                               String exMessage = exchange.getProperty(
>                                               Exchange.EXCEPTION_CAUGHT, 
> String.class);
>                               log.info("exmessage is:" + exMessage);
>                               if (exMessage.endsWith("404")) {
>                                       log.info("error code is 404");
>                                       return true;
>                               } else
>                                       return false;
>                       }
>               
> }).useExponentialBackOff().handled(true).to(this.errorQ).process(
>                               new DefaultErrorHandler());
> 
>       
> onException(Exception.class).useExponentialBackOff().handled(true).to(this.errorQ)
>               .process(new DefaultErrorHandler());
>               //
> onException(SoapFault.class).maximumRedeliveries(1).useExponentialBackOff().handled(true)
>               // .process(new DefaultErrorHandler()).to(this.errorQ);
> 
>               
> onException(java.net.ConnectException.class).maximumRedeliveries(1)
>                               .handled(true).to(this.retryQ).process(new 
> DefaultErrorHandler());
> 
>               // this is just the generic error handler where we set the 
> destination
>               // and the number of redeliveries we want to try
>               //
> errorHandler(deadLetterChannel("jmstx:queue:DLQ.cex.spq2").maximumRedeliveries(1));
> 
>               // IMP:If I add policy here then onException clause does not 
> work with
>               // 4.0. With
>               // exception block it does local retry with deadletter channel
>               // it works in4.2
>               from(this.inputQ).transacted("PROPAGATION_REQUIRED").bean(
>                               processorBean, "setLocationUrI")//
> .bean(myBean,"setSoap12Header").bean(myBean,"printExchangeHeaders")
>               
>                               .process(new Processor() {
>                                       public void process(Exchange exchange) 
> throws Exception {
>                                               // MyProcessorBean myBean = new 
> MyProcessorBean();
>                                               Message message = 
> exchange.getIn();
> 
>                                               Message in = exchange.getIn();
>                                               log.info("isTransacted:" + 
> exchange.isTransacted());
>                                               log
>                                                               .info("Messaged 
> read from the queue by camelRouter:= "
>                                                                               
> + in.getBody(String.class));
>                                               log.info("printing properties");
>                                               Map<String, Object> properties 
> = exchange
>                                                               
> .getProperties();
>                                               Set<String> sin = 
> properties.keySet();
>                                               for (String key : sin) {
>                                                       log.info(key + ":" + 
> properties.get(key));
>                                               }
> 
>                                               // 
> exchange.setPattern(ExchangePattern.InOut);
> 
>                                       }
>                               })
>                               
>                               /**
>                                * call external web service using 
> recipientlist patterns
>                                */
>                               
> .recipientList(header(Constants.DYNAMIC_HTTP_URI)).bean(
>                                               resProcessorBean, 
> "handleResponse");
>                       
> 
> 
> 
> Here are few lines from the log file that i am printing from the router
> code
> 
> 2010-06-12 06:33:24,739 |06:33:24,739 | INFO  | tenerContainer-4 |
> SCRouterBuilder                  | er.camelrouter.SCRouterBuilder$1  149 |
> HttpOperatioFailedException is:null
> 2010-06-12 06:33:24,739 |06:33:24,739 | INFO  | tenerContainer-4 |
> SCRouterBuilder                  | er.camelrouter.SCRouterBuilder$1  157 |
> exception is NOT instanceof http.HttpOperationFailedException
> 2010-06-12 06:33:24,739 |06:33:24,739 | INFO  | tenerContainer-4 |
> SCRouterBuilder                  | er.camelrouter.SCRouterBuilder$1  164 |
> exception is NOT instanceof org.apache.camel.RuntimeCamelException
> 2010-06-12 06:33:24,739 |06:33:24,739 | INFO  | tenerContainer-4 |
> SCRouterBuilder                  | er.camelrouter.SCRouterBuilder$1  166 |
> EXCEPTION CLASS IS:class
> org.apache.camel.component.http.HttpOperationFailedException
> 2010-06-12 06:33:24,739 |06:33:24,739 | INFO  | tenerContainer-4 |
> SCRouterBuilder                  | er.camelrouter.SCRouterBuilder$1  167 |
> EXCEPTION CAUSE IS:null
> 2010-06-12 06:33:24,739 |06:33:24,739 | ERROR | tenerContainer-4 |
> SCRouterBuilder                  | er.camelrouter.SCRouterBuilder$1  169 |
> org.apache.camel.component.http.HttpOperationFailedException: HTTP
> operation failed invoking http://lpf004689/orderapp1/OrderProcess with
> statusCode: 404
> 
> And here is the exception getting printed
> 
> 
> 2010-06-12 06:33:24,833 |06:33:24,833 | ERROR | tenerContainer-4 |
> TransactionErrorHandler          | rg.apache.camel.processor.Logger  248 |
> Failed delivery for exchangeId: a9119c36-5bee-4395-9eda-0e62199b54c5.
> Exhausted after delivery attempt: 1 caught:
> org.apache.camel.component.http.HttpOperationFailedException: HTTP
> operation failed invoking http://lpf004689/orderapp1/OrderProcess with
> statusCode: 404. Processed by failure processor:
> Pipeline[Channel[sendTo(Endpoint[jms://queue:MM.error])],
> channel[com.pf.simpleconsumer.camelrouter.defaulterrorhand...@b39fbc]]
> org.apache.camel.component.http.HttpOperationFailedException: HTTP
> operation failed invoking http://lpf004689/orderapp1/OrderProcess with
> statusCode: 404
>       at
> org.apache.camel.component.http.HttpProducer.populateHttpOperationFailedException(HttpProducer.java:150)
>       at
> org.apache.camel.component.http.HttpProducer.process(HttpProducer.java:92)
>       at
> org.apache.camel.processor.RedeliveryErrorHandler.processExchange(RedeliveryErrorHandler.java:177)
>       at
> org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:143)
>       at
> org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:88)
>       at
> org.apache.camel.spring.spi.TransactionErrorHandler.processByRegularErrorHandler(TransactionErrorHandler.java:90)
>       at
> org.apache.camel.spring.spi.TransactionErrorHandler.process(TransactionErrorHandler.java:81)
>       at
> org.apache.camel.processor.MulticastProcessor.doProcess(MulticastProcessor.java:266)
>       at
> org.apache.camel.processor.MulticastProcessor.doProcessSequential(MulticastProcessor.java:218)
>       at
> org.apache.camel.processor.MulticastProcessor.process(MulticastProcessor.java:137)
>       at
> org.apache.camel.processor.RecipientList.sendToRecipientList(RecipientList.java:102)
>       at
> org.apache.camel.processor.RecipientList.process(RecipientList.java:81)
>       at
> org.apache.camel.processor.DelegateProcessor.processNext(DelegateProcessor.java:53)
>       at
> org.apache.camel.processor.DelegateProcessor.proceed(DelegateProcessor.java:82)
>       at
> org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:161)
>       at
> org.apache.camel.processor.RedeliveryErrorHandler.processExchange(RedeliveryErrorHandler.java:177)
>       at
> org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:143)
>       at
> org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:88)
>       at
> org.apache.camel.processor.DefaultErrorHandler.process(DefaultErrorHandler.java:49)
>       at
> org.apache.camel.processor.DefaultChannel.process(DefaultChannel.java:228)
>       at org.apache.camel.processor.Pipeline.process(Pipeline.java:74)
>       at
> org.apache.camel.processor.RedeliveryErrorHandler.processExchange(RedeliveryErrorHandler.java:177)
>       at
> org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:143)
>       at
> org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:88)
>       at
> org.apache.camel.spring.spi.TransactionErrorHandler.access$001(TransactionErrorHandler.java:39)
>       at
> org.apache.camel.spring.spi.TransactionErrorHandler$1.doInTransactionWithoutResult(TransactionErrorHandler.java:140)
>       at
> org.springframework.transaction.support.TransactionCallbackWithoutResult.doInTransaction(TransactionCallbackWithoutResult.java:33)
>       at
> org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:128)
>       at
> org.apache.camel.spring.spi.TransactionErrorHandler.doInTransactionTemplate(TransactionErrorHandler.java:130)
>       at
> org.apache.camel.spring.spi.TransactionErrorHandler.processInTransaction(TransactionErrorHandler.java:106)
>       at
> org.apache.camel.spring.spi.TransactionErrorHandler.process(TransactionErrorHandler.java:84)
>       at
> org.apache.camel.processor.DelegateProcessor.processNext(DelegateProcessor.java:53)
>       at
> org.apache.camel.processor.DelegateProcessor.proceed(DelegateProcessor.java:82)
>       at
> org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:161)
>       at
> org.apache.camel.processor.RedeliveryErrorHandler.processExchange(RedeliveryErrorHandler.java:177)
>       at
> org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:143)
>       at
> org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:88)
>       at
> org.apache.camel.processor.DefaultErrorHandler.process(DefaultErrorHandler.java:49)
>       at
> org.apache.camel.processor.DefaultChannel.process(DefaultChannel.java:228)
>       at
> org.apache.camel.processor.UnitOfWorkProcessor.processNext(UnitOfWorkProcessor.java:66)
>       at
> org.apache.camel.processor.DelegateProcessor.process(DelegateProcessor.java:48)
>       at
> org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:67)
>       at
> org.apache.camel.component.jms.EndpointMessageListener.onMessage(EndpointMessageListener.java:84)
>       at
> org.springframework.jms.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:543)
>       at
> org.springframework.jms.listener.AbstractMessageListenerContainer.invokeListener(AbstractMessageListenerContainer.java:482)
>       at
> org.springframework.jms.listener.AbstractMessageListenerContainer.doExecuteListener(AbstractMessageListenerContainer.java:451)
>       at
> org.springframework.jms.listener.AbstractPollingMessageListenerContainer.doReceiveAndExecute(AbstractPollingMessageListenerContainer.java:323)
>       at
> org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(AbstractPollingMessageListenerContainer.java:241)
>       at
> org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java:982)
>       at
> org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.executeOngoingLoop(DefaultMessageListenerContainer.java:974)
>       at
> org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:876)
>       at java.lang.Thread.run(Thread.java:619)
> 
> 
> willem.jiang wrote:
>> 
>> What's the exception that you got?
>> I didn't see the detail info log level message.
>> 
>> Can I have a look at your whole Camel route?
>> 
>> Willem
>> 
>> gnanda wrote:
>>> Thanks a lot willem for the reply.
>>> I am still stuck with the issue, not sure what is going on
>>> I do get exception as
>>> org.apache.camel.component.http.HttpOperationFailedException. I have the
>>> exception log attached below.
>>> But when I tried getting the exception as HttpOperationFailedException
>>> it
>>> prints NULL and prints "exception is not instanceof
>>> http.HttpOperationFailedException" from the below log statements.
>>> Any help is appreciated
>>> 
>>> Here is the code snippet
>>> onException(Exception.class).onWhen(new Predicate() {
>>> 
>>>                     public boolean matches(Exchange exchange) {
>>>                             log.info(exchange);
>>> org.apache.camel.component.http.HttpOperationFailedException ex1 =
>>> exchange.getProperty(Exchange.EXCEPTION_CAUGHT,
>>>                                     
>>> org.apache.camel.component.http.HttpOperationFailedException.class);
>>>                             log.info("HttpOperatioFailedException is:"+ex1);
>>>                             Exception ex = 
>>> exchange.getProperty(Exchange.EXCEPTION_CAUGHT,
>>>                                             Exception.class);
>>>                             if(ex instanceof
>>> org.apache.camel.component.http.HttpOperationFailedException){
>>>                                     log.info("exception is instanceof
>>> http.HttpOperationFailedException");
>>>                                     
>>> org.apache.camel.component.http.HttpOperationFailedException ex2
>>> =(org.apache.camel.component.http.HttpOperationFailedException)ex;
>>>                                     log.info("response body is:"+ 
>>> ex2.getResponseBody());
>>>                             }
>>>                             else{
>>>                                     log.info("exception is not instanceof
>>> http.HttpOperationFailedException");
>>>                             }
>>> 
>>> 2010-06-11 12:18:29,898 |12:18:29,898 | ERROR | tenerContainer-5 |
>>> DefaultErrorHandler              | rg.apache.camel.processor.Logger  248
>>> |
>>> Failed delivery for exchangeId:
>>> ID:LPF004689-2995-1276268480402-0:6:1:1:1.
>>> Exhausted after delivery attempt: 2 caught:
>>> org.apache.camel.component.http.HttpOperationFailedException: HTTP
>>> operation
>>> failed invoking http://localhost/orderapp/OrderProcess with statusCode:
>>> 500.
>>> Processed by failure processor:
>>> Pipeline[Channel[sendTo(Endpoint[jms://queue:MM.500Q])],
>>> channel[com.pf.simpleconsumer.camelrouter.defaulterrorhand...@1bc1819]]
>>> org.apache.camel.component.http.HttpOperationFailedException: HTTP
>>> operation
>>> failed invoking http://localhost/orderapp/OrderProcess with statusCode:
>>> 500
>>>     at
>>> org.apache.camel.component.http.HttpProducer.populateHttpOperationFailedException(HttpProducer.java:150)
>>>     at
>>> org.apache.camel.component.http.HttpProducer.process(HttpProducer.java:92)
>>>     at
>>> org.apache.camel.processor.SendProcessor$1.doInProducer(SendProcessor.java:97)
>>>     at
>>> org.apache.camel.processor.SendProcessor$1.doInProducer(SendProcessor.java:95)
>>>     at
>>> org.apache.camel.impl.ProducerCache.doInProducer(ProducerCache.java:146)
>>> 
>>> 
>>> 
>>> willem.jiang wrote:
>>>> Hi,
>>>>
>>>> You can get the soap fault  message detail by checking out the 
>>>> responseBody from the HttpOperationFailedException.
>>>>
>>>> Willem
>>>>
>>>> gnanda wrote:
>>>>> Hi All,
>>>>> I am using camel 2.2 with servicemix 4.2
>>>>> I am trying to retrieve soapFault message from
>>>>> HttpOperationFailedException
>>>>> I could able to print the exception as below
>>>>> Exception ex =
>>>>> exchange.getProperty(Exchange.EXCEPTION_CAUGHT,Exception.class);
>>>>> log.info(ex);
>>>>> It prints the message as below
>>>>> "org.apache.camel.component.http.HttpOperationFailedException: HTTP
>>>>> operation failed invoking
>>>>> http://localhost/orderapp/OrderProcess?httpClientConfigurerRef=com.pf.simpleconsumer.camelrouter.DefaultHttpClientConfigurer
>>>>> with statusCode: 500"
>>>>>
>>>>> The above string does not have soapfault message.How would I extract
>>>>> soapfault message in my onException() block ?
>>>>> How do I retrieve the fault code?
>>>>>
>>>>> Any help is appreciated
>>>>>
>>>>>
>>>>
>>>>
>>> 
>> 
>> 
>> 
>  http://old.nabble.com/file/p28863872/SCRouterBuilder.java
> SCRouterBuilder.java 
> 

-- 
View this message in context: 
http://old.nabble.com/reading-soapfault-message-from-HttpOperationFailedException-tp28847433p28875336.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to