camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Charles Moulliard <>
Subject Error with Body type (camel 2.4)
Date Tue, 11 Jan 2011 11:31:18 GMT

I have created a unit test using camel-2.4 to send HTTP request to a
Jetty Server deployed on SMX4. It works fine when I create an HTTP
request from my browser but get the following error when running the

Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 1.055
sec <<< FAILURE!
 Time elapsed: 1.019 sec  <<< ERROR!
org.apache.camel.CamelExecutionException: Exception occurred during
execution on the exchange: Exchange[Message: [Body is instance of]]
	at org.apache.camel.util.ObjectHelper.wrapCamelExecutionException(
	at org.apache.camel.util.ExchangeHelper.extractResultBody(
	at org.apache.camel.impl.DefaultProducerTemplate.extractResultBody(
	at org.apache.camel.impl.DefaultProducerTemplate.sendBodyAndHeader(
	at org.apache.camel.impl.DefaultProducerTemplate.requestBodyAndHeader(
	at com.isightpartners.streaming.RouteTest.testHttpClient(
	at com.isightpartners.streaming.RouteTest.testHttpRouteWithMessageHeader(

Caused by: org.apache.camel.component.http.HttpOperationFailedException:
HTTP operation failed invoking http://localhost:9090/upload) with
statusCode: 404
	at org.apache.camel.component.http.HttpProducer.populateHttpOperationFailedException(
	at org.apache.camel.component.http.HttpProducer.process(
	at org.apache.camel.impl.converter.AsyncProcessorTypeConverter$ProcessorToAsyncProcessorBridge.process(
	at org.apache.camel.util.AsyncProcessorHelper.process(
	at org.apache.camel.processor.SendProcessor$2.doInAsyncProducer(
	at org.apache.camel.impl.ProducerCache.doInAsyncProducer(
	at org.apache.camel.processor.SendProcessor.process(

Is it because the class used to stream the content has changed between
camel 2.4 and camel 2.5 ?

    private void testHttpClient(String uri) throws Exception {
        System.getProperties().put("HTTPClient.dontChunkRequests", "yes");

        MockEndpoint mockEndpoint = getMockEndpoint("mock:a");
        mockEndpoint.expectedBodiesReceived("<html><body>Book 123 is
Camel in Action</body></html>");

        template.requestBodyAndHeader(uri, new
ByteArrayInputStream("This is a test".getBytes()), "Content-Type",

        List<Exchange> list = mockEndpoint.getReceivedExchanges();
        Exchange exchange = list.get(0);
        assertNotNull("exchange", exchange);

        Message in = exchange.getIn();
        assertNotNull("in", in);

        Map<String, Object> headers = in.getHeaders();"Headers: " + headers);

        assertTrue("Should be more than one header but was: " +
headers, headers.size() > 0);

        // should get the Content-Length
        // assertNotNull("Should get the content-lenghth ",

    protected RouteBuilder createRouteBuilder() throws Exception {
        return new RouteBuilder() {
            public void configure() {




Charles Moulliard

Sr. Principal Solution Architect - FuseSource
Apache Committer

Blog :
Twitter :
Linkedin :
Skype: cmoulliard

View raw message