It cannot take any object,
it must be one of the primatives
e.g. java.lang.Boolean, java.lang.Integer, etc.
Look at the javadocs for for info.
If what you want is to make a message object out of your Object then you may want to use the ObjectMessage instead of MapMessage. Secondly your Object and all its referenced Objects must be serializable or you will get exactly the same exception.
Alternatively, you may want to use the MapMessage but you will have to break your Object up using its getters to populate your MapMessage and then reconstruct it again when you receive it.