camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Francois Eyl <>
Subject Mina route on servicemix - Error executing command: java.lang.NullPointerException
Date Mon, 19 Mar 2012 22:42:28 GMT
Hi guys,

I've created a very simple camel route using the mina component. This 
route actually uses a custom Codec and is packaged as osgi bundle. 
Whenever I deploy it to servicemix (apache-servicemix-4.4.1-fuse-03-06) 
the bundle is not getting the Active state but Installed. And of course 
when I try to start it I'm getting a "Error executing command: 
java.lang.NullPointerException" from the console, but nothing in the logs...

Can somebody help me make this work I can't figure out what's 
happening... Is this a packaging issue? I guess it has something to do 
with my codec loading, but I'm stuck here now.

Here is my XML route:

<?xml version="1.0" encoding="UTF-8"?>
<bean id="myCodec" class="" />
<camelContext xmlns="">
<from uri="mina:tcp://localhost:9000?sync=true&amp;codec=#myCodec" />
<to uri="log:IncomingMsg" />

Here is my codecfactory (removed imports):

public class MyMinaCodec implements
         ProtocolCodecFactory {

     public ProtocolDecoder getDecoder(IoSession session) throws Exception {
         return new MyMinaDecoder();

     public ProtocolEncoder getEncoder(IoSession session) throws Exception {
         return new ProtocolEncoder() {

             public void encode(IoSession arg0, Object arg1, 
ProtocolEncoderOutput arg2) throws Exception {


             public void dispose(IoSession arg0) throws Exception {


And here is my decoder implementation (removed imports) :
public class MyMinaDecoder extends CumulativeProtocolDecoder {

     public static final int MSG_HEADER_SIZE = 14;

     protected boolean doDecode(IoSession session, IoBuffer in, 
ProtocolDecoderOutput out) throws Exception {
         // try to read the message header
         if (in.remaining() >= MSG_HEADER_SIZE) {
             out.write(readsUnsignedBytesToString(in, MSG_HEADER_SIZE));
             return true;
         } else {
             // not enough data
             return false;

     private String readsUnsignedBytesToString(IoBuffer in, int length) {
         char[] unsignedChars = new char[length];
         for (int i = 0; i < length; i++) {
             unsignedChars[i] = (char) in.getUnsigned();
         return new String(unsignedChars);

And here is my pom.xml:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="" 


<name>My MINA Test</name>



Thanks for your help,

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message