Hi Claus,

Ok - I think I've tracked this problem down (after a lot of frustration and
wasted time!). You should be easily able to reproduce the problem with the
code I posted originally if you simply use HttpComponent version 4.2 (i.e.
'httpclient-4.2.jar' and 'httpcore-4.2.jar'). The latest version is 4.2.1,
and that version works fine for me.

With the 4.2 versions I traced the NPE down to a call to 'new
StringEntity()' (on line 424 of
org.apache.camel.component.http4.HttpProducer), which seems to be a known
problem: 
http://www.mail-archive.com/httpclient-users@hc.apache.org/msg05668.html
http://www.mail-archive.com/httpclient-users@hc.apache.org/msg05668.html .

Although this post ( http://dvdsdirect.us/notesstringentity.jsp
http://dvdsdirect.us/notesstringentity.jsp ) suggests the problem is also
present in version 4.2.1, my use-case seems to be working fine with that
version.

As part of my investigations I confirmed that the HttpClient version 3
libraries (and therefore using the 'camel-http' component (as opposed to
'camel-http4' component)) worked fine too, but I'm trying to keep my project
on the latest versions of everything, so I think I should be fine with
HttpComponent 4.2.1.

Thanks for looking into this particular issue - but I should be fine to
continue now. I don't think Camel needs to do anything, except maybe,
somehow, notify people of this potential problem with HttpComponent 4.2.



--
View this message in context: 
http://camel.465427.n5.nabble.com/Http4-component-throws-useless-NPE-if-request-body-is-String-instead-of-InputStream-tp5717268p5717449.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to