title: Simple Example of Apache Camel and Mina (Karaf) throws CamelExchangeException: Cannot write body
body: <p>I have taken the simple activemq-camel-blueprint example from ServiceMix 4.4.0, and added in a Mina TCP socket to read from ASCII lines. </p>
  
  <pre><code>&lt;camelContext xmlns="http://camel.apache.org/schema/blueprint"&gt;
      &lt;route&gt;
          &lt;from uri="mina:tcp://localhost:4001?textline=true&amp;amp;sync=false" /&gt;
          &lt;bean ref="NMEAString" method="ingest" /&gt;
          &lt;to uri="activemq:queue:LOG.ME"/&gt;
      &lt;/route&gt;
      &lt;route&gt;
          &lt;from uri="activemq:queue:LOG.ME" /&gt;
          &lt;to uri="log:ExampleActiveMQRouterBlueprint" /&gt;
      &lt;/route&gt;
  &lt;/camelContext&gt;
  </code></pre>
  
  <p>I am running the example within Karaf. All the NMEAString does is print out the object to STDOUT. </p>
  
  <p>I run a little program to push an ASCII file to a socket connection. It pushes in the whole file (~40) lines in a few milliseconds. </p>
  
  <p>I see a STDOUT printout within Karaf at about 30 seconds between lines. 
  I am getting the following exceptions within my servicemix.log file:</p>
  
  <p>Does anyone know what this exception means and why it is throwing it with such a simple
  example?</p>
  
  <blockquote>
    <p>org.apache.camel.CamelException: org.apache.camel.CamelExchangeException: Cannot write body. Exchange[Message: [Body is null]]
        at org.apache.camel.component.mina.MinaConsumer$ReceiveHandler.exceptionCaught(MinaConsumer.java:91)[186:org.apache.camel.camel-mina:2.8.3]
        at org.apache.mina.common.support.AbstractIoFilterChain$TailFilter.exceptionCaught(AbstractIoFilterChain.java:564)[187:org.apache.servicemix.bundles.mina:1.1.7.5]
        at org.apache.mina.common.support.AbstractIoFilterChain.callNextExceptionCaught(AbstractIoFilterChain.java:345)[187:org.apache.servicemix.bundles.mina:1.1.7.5]
        at org.apache.mina.common.support.AbstractIoFilterChain.access$1000(AbstractIoFilterChain.java:53)[187:org.apache.servicemix.bundles.mina:1.1.7.5]
        at org.apache.mina.common.support.AbstractIoFilterChain$EntryImpl$1.exceptionCaught(AbstractIoFilterChain.java:643)[187:org.apache.servicemix.bundles.mina:1.1.7.5]
        at org.apache.mina.filter.executor.ExecutorFilter.processEvent(ExecutorFilter.java:224)[187:org.apache.servicemix.bundles.mina:1.1.7.5]
        at org.apache.mina.filter.executor.ExecutorFilter$ProcessEventsRunnable.run(ExecutorFilter.java:264)[187:org.apache.servicemix.bundles.mina:1.1.7.5]
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)[:1.6.0_29]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)[:1.6.0_29]
        at java.lang.Thread.run(Thread.java:662)[:1.6.0_29]
    Caused by: org.apache.camel.CamelExchangeException: Cannot write body. Exchange[Message: [Body is null]]
        at org.apache.camel.component.mina.MinaHelper.writeBody(MinaHelper.java:55)[186:org.apache.camel.camel-mina:2.8.3]
        at org.apache.camel.component.mina.MinaConsumer$ReceiveHandler.messageReceived(MinaConsumer.java:148)[186:org.apache.camel.camel-mina:2.8.3]
        at org.apache.mina.common.support.AbstractIoFilterChain$TailFilter.messageReceived(AbstractIoFilterChain.java:570)[187:org.apache.servicemix.bundles.mina:1.1.7.5]
        at org.apache.mina.common.support.AbstractIoFilterChain.callNextMessageReceived(AbstractIoFilterChain.java:299)[187:org.apache.servicemix.bundles.mina:1.1.7.5]
        at org.apache.mina.common.support.AbstractIoFilterChain.access$1100(AbstractIoFilterChain.java:53)[187:org.apache.servicemix.bundles.mina:1.1.7.5]
        at org.apache.mina.common.support.AbstractIoFilterChain$EntryImpl$1.messageReceived(AbstractIoFilterChain.java:648)[187:org.apache.servicemix.bundles.mina:1.1.7.5]
        at org.apache.mina.filter.executor.ExecutorFilter.processEvent(ExecutorFilter.java:220)[187:org.apache.servicemix.bundles.mina:1.1.7.5]
        ... 4 more</p>
  </blockquote>