MessageQ1 marseille = new MessageQ1("");Why do you initialise the variable "marseille" to a newly-created MessageQ1 instance, and then immediately overwrite it? This is a programming error of some kind.
marseille = (MessageQ1) fins;
I want to cast the ObjectMessage into a MessageQ1 object.You can only cast an object to a MessageQ1 if the object in question is a MessageQ1. But it isn't, it is an ObjectMessageImpl, which is a class provided by your JMS provider which implements the ObjectMessage interface.
String contents = ...Yes, so if the code that receives that message calls getObject() you will get a String - the same String you put in it.
ObjectMessage obj = session.createObjectMessage();