Hi,

Yeah removing the header CamelHttpUri before routing to http endpoint did
work, because if this header is not present the httpProducer picks up the
uri from the endpoint itself which is set to the right uri.

Thanks and will raise a jira ticket for this.

Cheers!!
Katta



Claus Ibsen-2 wrote:
> 
> Hi
> 
> Thanks for the findings. Can you try removing those headers, you can
> use .removeHeader to get rid of them.
> 
> And create a ticket in JIRA so we can fix it in 2.1 that bridging HTTP
> related endpoints works.
> We may need to add some headers so Camel knows you want to bridge them
> to avoid using special headers or wrap return codes etc.
> 
> 
> On Thu, Aug 20, 2009 at 6:30 PM, Srivatsa Katta<[email protected]>
> wrote:
>>
>> Hi,
>>
>> Was debugging through this issue, and below are my observations.
>>
>> Lets say I am using this url (http://localhost:6666/customers/accounts)
>> from
>> the client to post
>>
>> 1. In HttpProducer class when I inspected the Camel Exchange In Headers,
>> noticed both CamelHttpUri and CamelHttpPath headers having the same
>> value.
>> eg: /customers/accounts
>>
>> And in the  protected HttpMethod createMethod(Exchange exchange) an uri
>> is
>> being constructed by concatenating CamelHttpUri  +  CamelHttpPath,  which
>> means in this example uri becomes /customers/accounts/customers/accounts
>> and
>> this same uri is being used to construct
>> org.apache.commons.httpclient.HttpMethod which of course is not
>> constructed
>> with the right uri and hence fields like host and all in the HttpMethod
>> object is not set properly, I suspect this could be the problem.
>>
>> Wouldn't the camel header (CamelHttpUri ) in the exchange should have
>> been
>> ideally set to http://localhost:6666, which would have resulted in the
>> right
>> uri being constructed.
>>
>> But wasn't sure where these camel headers are being set in the exchanges.
>>
>> Does it makes any sense to any of the camel contributors ??
>>
>> Cheers!!
>> Katta
>>
>>
>>
>>
>>
>>
>>
>> Srivatsa Katta wrote:
>>>
>>> Hi,
>>>
>>> Find the trace below.
>>>
>>> java.lang.IllegalArgumentException: host parameter is null
>>>       at
>>> org.apache.commons.httpclient.HttpConnection.<init>(HttpConnection.java:206)
>>>       at
>>> org.apache.commons.httpclient.HttpConnection.<init>(HttpConnection.java:155)
>>>       at
>>> org.apache.commons.httpclient.MultiThreadedHttpConnectionManager$HttpConnectionWithReference.<init>(MultiThreadedHttpConnectionManager.java:1145)
>>>       at
>>> org.apache.commons.httpclient.MultiThreadedHttpConnectionManager$ConnectionPool.createConnection(MultiThreadedHttpConnectionManager.java:762)
>>>       at
>>> org.apache.commons.httpclient.MultiThreadedHttpConnectionManager.doGetConnection(MultiThreadedHttpConnectionManager.java:476)
>>>       at
>>> org.apache.commons.httpclient.MultiThreadedHttpConnectionManager.getConnectionWithTimeout(MultiThreadedHttpConnectionManager.java:416)
>>>       at
>>> org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:153)
>>>       at
>>> org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:397)
>>>       at
>>> org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:323)
>>>       at
>>> org.apache.camel.component.http.HttpProducer.executeMethod(HttpProducer.java:147)
>>>       at
>>> org.apache.camel.component.http.HttpProducer.process(HttpProducer.java:74)
>>>       at
>>> org.apache.camel.processor.SendProcessor$1.doInProducer(SendProcessor.java:65)
>>>       at
>>> org.apache.camel.processor.SendProcessor$1.doInProducer(SendProcessor.java:63)
>>>       at
>>> org.apache.camel.impl.ProducerCache.doInProducer(ProducerCache.java:142)
>>>       at
>>> org.apache.camel.processor.SendProcessor.process(SendProcessor.java:62)
>>>       at
>>> org.apache.camel.processor.interceptor.StreamCachingInterceptor.process(StreamCachingInterceptor.java:52)
>>>       at
>>> org.apache.camel.processor.RedeliveryErrorHandler.processExchange(RedeliveryErrorHandler.java:186)
>>>       at
>>> org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:155)
>>>       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:148)
>>>       at
>>> org.apache.camel.processor.DelegateProcessor.processNext(DelegateProcessor.java:53)
>>>       at
>>> org.apache.camel.processor.ChoiceProcessor.process(ChoiceProcessor.java:51)
>>>       at
>>> org.apache.camel.processor.interceptor.StreamCachingInterceptor.process(StreamCachingInterceptor.java:52)
>>>       at
>>> org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:61)
>>>       at
>>> org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:61)
>>>       at
>>> org.apache.camel.processor.RedeliveryErrorHandler.processExchange(RedeliveryErrorHandler.java:186)
>>>       at
>>> org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:155)
>>>       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:148)
>>>       at
>>> org.apache.camel.processor.UnitOfWorkProcessor.processNext(UnitOfWorkProcessor.java:54)
>>>       at
>>> org.apache.camel.processor.DelegateProcessor.process(DelegateProcessor.java:48)
>>>       at
>>> org.apache.camel.component.http.CamelServlet.service(CamelServlet.java:58)
>>>       at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
>>>       at
>>> org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:502)
>>>       at
>>> org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:389)
>>>       at
>>> org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
>>>       at
>>> org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:230)
>>>       at
>>> org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
>>>       at org.mortbay.jetty.Server.handle(Server.java:326)
>>>       at
>>> org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:534)
>>>       at
>>> org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:879)
>>>       at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:747)
>>>       at
>>> org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:218)
>>>       at
>>> org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
>>>       at
>>> org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409)
>>>       at
>>> org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:520)
>>>
>>>
>>>
>>> Claus Ibsen-2 wrote:
>>>>
>>>> Can you post the stacktrace
>>>>
>>>> On Thu, Aug 20, 2009 at 9:17 AM, Srivatsa Katta<[email protected]>
>>>> wrote:
>>>>>
>>>>> Hi,
>>>>>
>>>>> I have the following routes defined in my application.
>>>>>
>>>>>
>>>>> from("jetty:http://0.0.0.0:6666?matchOnUriPrefix=true";)
>>>>>
>>>>> .to("http://localhost:8899?throwExceptionOnFailure=false";);
>>>>> from("jetty:http://0.0.0.0:8899?matchOnUriPrefix=true";).to("cxfbean:customerCXFService");
>>>>>
>>>>>
>>>>> Basically the first endpoint (6666) is just routing/redirecting to the
>>>>> second end point (8899).
>>>>>
>>>>> When the client uses the endpoint (8899) directly, it works fine. But
>>>>> when
>>>>> the client uses the endpoint 6666, it has to ideally route it to 8899
>>>>> and
>>>>> then return the result but then it throws IllegalArgumentException
>>>>> host
>>>>> parameter is null.
>>>>>
>>>>> The same route configuration works fine in the 2.0 M2 release, started
>>>>> choking after I upgraded to M3 release.
>>>>>
>>>>> Any help appreciated.
>>>>>
>>>>> Cheers!!
>>>>> Katta
>>>>> --
>>>>> View this message in context:
>>>>> http://www.nabble.com/HTTP-component-throwing-IllegalArgumentException-in-M3-release.-tp25057133p25057133.html
>>>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Claus Ibsen
>>>> Apache Camel Committer
>>>>
>>>> Open Source Integration: http://fusesource.com
>>>> Blog: http://davsclaus.blogspot.com/
>>>> Twitter: http://twitter.com/davsclaus
>>>>
>>>>
>>>
>>>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/HTTP-component-throwing-IllegalArgumentException-in-M3-release.-tp25057133p25065484.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>
>>
> 
> 
> 
> -- 
> Claus Ibsen
> Apache Camel Committer
> 
> Open Source Integration: http://fusesource.com
> Blog: http://davsclaus.blogspot.com/
> Twitter: http://twitter.com/davsclaus
> 
> 

-- 
View this message in context: 
http://www.nabble.com/HTTP-component-throwing-IllegalArgumentException-in-M3-release.-tp25057133p25074882.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to