camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <claus.ib...@gmail.com>
Subject Re: How can I catch a response? (http component)
Date Thu, 15 Dec 2011 07:46:15 GMT
Hi

How do you run the code? Do you run it in a container such as
ServiceMix, or something else?


On Thu, Dec 15, 2011 at 8:10 AM, focaldi <ferit.ocaldi@tav.aero> wrote:
> Hi I am trying to read response body but I took an exception like this.
> Actually, I want to read http://tcmb.gov.tr/kurlar/today.xml url. But I
> couldt :(. Pls help me.
>
> Added to pom.xml :
> <dependency>
>    <groupId>org.apache.camel</groupId>
>    <artifactId>camel-http</artifactId>
>    <version>2.9.0-RC1</version>
> </dependency>
>
> My route is :
>                camelContext.addRoutes(new RouteBuilder() {
>                                @Override
>                                public void configure() throws Exception
{
>                                        from("timer://foo?fixedRate=true&delay=0&period=10000")
>                                    .to("http://www.google.com").process(new
Processor() {
>                                                @Override
>                                                public void process(Exchange
arg0) throws Exception {
>                                                        System.out.println(arg0.getIn());
>                                                }
>                                        });
>                                }
>                        });
>
>
> [                          main] DefaultCamelContext            INFO
 Apache
> Camel 2.9.0-RC1 (CamelContext: camel-1) is starting
> [                          main] DefaultCamelContext            INFO
> HandleFault is enabled on CamelContext: camel-1
> [                          main] ManagementStrategyFactory      INFO
 JMX
> enabled. Using ManagedManagementStrategy.
> [                          main] ultManagementLifecycleStrategy INFO
> StatiticsLevel at All so enabling load performance statistics
> [                          main] AnnotationTypeConverterLoader  INFO  Found
> 3 packages with 15 @Converter classes to load
> [                          main] DefaultTypeConverter           INFO
 Loaded
> 163 core type converters (total 163 type converters)
> [                          main] AnnotationTypeConverterLoader  INFO  Loaded
> 4 @Converter classes
> [                          main] DefaultTypeConverter           INFO
 Loaded
> additional 14 type converters (total 177 type converters) in 0.054 seconds
> [                          main] DefaultCamelContext            INFO
 Route:
> route1 started and consuming from:
> Endpoint[timer://foo?delay=0&fixedRate=true&period=10000]
> [                          main] DefaultCamelContext            INFO
 Total
> 1 routes, of which 1 is started.
> [                          main] DefaultCamelContext            INFO
 Apache
> Camel 2.9.0-RC1 (CamelContext: camel-1) started in 0.890 seconds
> [                           foo] DefaultErrorHandler            ERROR
Failed
> delivery for exchangeId: ID-FERIT-OCALDI-59648-1323932289447-0-1. Exhausted
> after delivery attempt: 1 caught: java.lang.RuntimeException:
> java.lang.reflect.InvocationTargetException
> java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
>        at
> org.apache.camel.component.http.HttpMethods.createMethod(HttpMethods.java:49)[camel-http-2.9.0-RC1.jar:2.9.0-RC1]
>        at
> org.apache.camel.component.http.HttpProducer.createMethod(HttpProducer.java:333)[camel-http-2.9.0-RC1.jar:2.9.0-RC1]
>        at
> org.apache.camel.component.http.HttpProducer.process(HttpProducer.java:90)[camel-http-2.9.0-RC1.jar:2.9.0-RC1]
>        at
> org.apache.camel.util.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:61)[camel-core-2.9.0-RC1.jar:2.9.0-RC1]
>        at
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)[camel-core-2.9.0-RC1.jar:2.9.0-RC1]
>        at
> org.apache.camel.processor.SendProcessor$2.doInAsyncProducer(SendProcessor.java:115)[camel-core-2.9.0-RC1.jar:2.9.0-RC1]
>        at
> org.apache.camel.impl.ProducerCache.doInAsyncProducer(ProducerCache.java:285)[camel-core-2.9.0-RC1.jar:2.9.0-RC1]
>        at
> org.apache.camel.processor.SendProcessor.process(SendProcessor.java:110)[camel-core-2.9.0-RC1.jar:2.9.0-RC1]
>        at
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)[camel-core-2.9.0-RC1.jar:2.9.0-RC1]
>        at
> org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99)[camel-core-2.9.0-RC1.jar:2.9.0-RC1]
>        at
> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)[camel-core-2.9.0-RC1.jar:2.9.0-RC1]
>        at
> org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:71)[camel-core-2.9.0-RC1.jar:2.9.0-RC1]
>        at
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)[camel-core-2.9.0-RC1.jar:2.9.0-RC1]
>        at
> org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99)[camel-core-2.9.0-RC1.jar:2.9.0-RC1]
>        at
> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)[camel-core-2.9.0-RC1.jar:2.9.0-RC1]
>        at
> org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:92)[camel-core-2.9.0-RC1.jar:2.9.0-RC1]
>        at
> org.apache.camel.processor.interceptor.HandleFaultInterceptor.process(HandleFaultInterceptor.java:42)[camel-core-2.9.0-RC1.jar:2.9.0-RC1]
>        at
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)[camel-core-2.9.0-RC1.jar:2.9.0-RC1]
>        at
> org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:321)[camel-core-2.9.0-RC1.jar:2.9.0-RC1]
>        at
> org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:212)[camel-core-2.9.0-RC1.jar:2.9.0-RC1]
>        at
> org.apache.camel.processor.interceptor.DefaultChannel.process(DefaultChannel.java:304)[camel-core-2.9.0-RC1.jar:2.9.0-RC1]
>        at
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)[camel-core-2.9.0-RC1.jar:2.9.0-RC1]
>        at
> org.apache.camel.processor.Pipeline.process(Pipeline.java:117)[camel-core-2.9.0-RC1.jar:2.9.0-RC1]
>        at
> org.apache.camel.processor.Pipeline.process(Pipeline.java:80)[camel-core-2.9.0-RC1.jar:2.9.0-RC1]
>        at
> org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:102)[camel-core-2.9.0-RC1.jar:2.9.0-RC1]
>        at
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)[camel-core-2.9.0-RC1.jar:2.9.0-RC1]
>        at
> org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99)[camel-core-2.9.0-RC1.jar:2.9.0-RC1]
>        at
> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)[camel-core-2.9.0-RC1.jar:2.9.0-RC1]
>        at
> org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:71)[camel-core-2.9.0-RC1.jar:2.9.0-RC1]
>        at
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:99)[camel-core-2.9.0-RC1.jar:2.9.0-RC1]
>        at
> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:86)[camel-core-2.9.0-RC1.jar:2.9.0-RC1]
>        at
> org.apache.camel.component.timer.TimerConsumer.sendTimerExchange(TimerConsumer.java:121)[camel-core-2.9.0-RC1.jar:2.9.0-RC1]
>        at
> org.apache.camel.component.timer.TimerConsumer$1.run(TimerConsumer.java:58)[camel-core-2.9.0-RC1.jar:2.9.0-RC1]
>        at java.util.TimerThread.mainLoop(Unknown Source)[:1.6.0_29]
>        at java.util.TimerThread.run(Unknown Source)[:1.6.0_29]
> [                           foo] TimerConsumer                  ERROR
Error
> processing exchange. Exchange[Message: [Body is null]]. Caused by:
> [java.lang.RuntimeException - java.lang.reflect.InvocationTargetException]
> java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
>        at
> org.apache.camel.component.http.HttpMethods.createMethod(HttpMethods.java:49)[camel-http-2.9.0-RC1.jar:2.9.0-RC1]
>        at
> org.apache.camel.component.http.HttpProducer.createMethod(HttpProducer.java:333)[camel-http-2.9.0-RC1.jar:2.9.0-RC1]
>        at
> org.apache.camel.component.http.HttpProducer.process(HttpProducer.java:90)[camel-http-2.9.0-RC1.jar:2.9.0-RC1]
>        at
> org.apache.camel.util.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:61)[camel-core-2.9.0-RC1.jar:2.9.0-RC1]
>        at
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)[camel-core-2.9.0-RC1.jar:2.9.0-RC1]
>        at
> org.apache.camel.processor.SendProcessor$2.doInAsyncProducer(SendProcessor.java:115)[camel-core-2.9.0-RC1.jar:2.9.0-RC1]
>        at
> org.apache.camel.impl.ProducerCache.doInAsyncProducer(ProducerCache.java:285)[camel-core-2.9.0-RC1.jar:2.9.0-RC1]
>        at
> org.apache.camel.processor.SendProcessor.process(SendProcessor.java:110)[camel-core-2.9.0-RC1.jar:2.9.0-RC1]
>        at
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)[camel-core-2.9.0-RC1.jar:2.9.0-RC1]
>        at
> org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99)[camel-core-2.9.0-RC1.jar:2.9.0-RC1]
>        at
> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)[camel-core-2.9.0-RC1.jar:2.9.0-RC1]
>        at
> org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:71)[camel-core-2.9.0-RC1.jar:2.9.0-RC1]
>        at
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)[camel-core-2.9.0-RC1.jar:2.9.0-RC1]
>        at
> org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99)[camel-core-2.9.0-RC1.jar:2.9.0-RC1]
>        at
> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)[camel-core-2.9.0-RC1.jar:2.9.0-RC1]
>        at
> org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:92)[camel-core-2.9.0-RC1.jar:2.9.0-RC1]
>        at
> org.apache.camel.processor.interceptor.HandleFaultInterceptor.process(HandleFaultInterceptor.java:42)[camel-core-2.9.0-RC1.jar:2.9.0-RC1]
>        at
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)[camel-core-2.9.0-RC1.jar:2.9.0-RC1]
>        at
> org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:321)[camel-core-2.9.0-RC1.jar:2.9.0-RC1]
>        at
> org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:212)[camel-core-2.9.0-RC1.jar:2.9.0-RC1]
>        at
> org.apache.camel.processor.interceptor.DefaultChannel.process(DefaultChannel.java:304)[camel-core-2.9.0-RC1.jar:2.9.0-RC1]
>        at
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)[camel-core-2.9.0-RC1.jar:2.9.0-RC1]
>        at
> org.apache.camel.processor.Pipeline.process(Pipeline.java:117)[camel-core-2.9.0-RC1.jar:2.9.0-RC1]
>        at
> org.apache.camel.processor.Pipeline.process(Pipeline.java:80)[camel-core-2.9.0-RC1.jar:2.9.0-RC1]
>        at
> org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:102)[camel-core-2.9.0-RC1.jar:2.9.0-RC1]
>        at
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)[camel-core-2.9.0-RC1.jar:2.9.0-RC1]
>        at
> org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99)[camel-core-2.9.0-RC1.jar:2.9.0-RC1]
>        at
> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)[camel-core-2.9.0-RC1.jar:2.9.0-RC1]
>        at
> org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:71)[camel-core-2.9.0-RC1.jar:2.9.0-RC1]
>        at
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:99)[camel-core-2.9.0-RC1.jar:2.9.0-RC1]
>        at
> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:86)[camel-core-2.9.0-RC1.jar:2.9.0-RC1]
>        at
> org.apache.camel.component.timer.TimerConsumer.sendTimerExchange(TimerConsumer.java:121)[camel-core-2.9.0-RC1.jar:2.9.0-RC1]
>        at
> org.apache.camel.component.timer.TimerConsumer$1.run(TimerConsumer.java:58)[camel-core-2.9.0-RC1.jar:2.9.0-RC1]
>        at java.util.TimerThread.mainLoop(Unknown Source)[:1.6.0_29]
>        at java.util.TimerThread.run(Unknown Source)[:1.6.0_29]
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/How-can-I-catch-a-response-http-component-tp5076707p5076707.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/

Mime
View raw message