Deserialize an Object in the JMS message

Has anyone tried deserializing a JMS Object message from IBM MQ Visual Edit? I need to decipher an object that was send as a JMS message through MQ. I saved the message to a file and tried to read it using ObjectInputStream as follows:

ObjectInputStream objectStream = new ObjectInputStream(new DataInputStream(new FileInputStream("PATH TO THE FILE")));
SomeObject result = ((SomeObject)objectStream.readObject());

But I get an error: invalid stream header: 52464820
    at com.railinc.emis.transaction.model.DeserializerClass.main(

I went an researched a little bit on this and found the same classes that were used to serialize should be used for deserializing.

If someone has tried this before, please let me know your experience with it.


I don't know IBM MQ Visual Edit but if it has a feature to save an ObjectMessage, then it will probably not only save the object contained in the message, but also the headers (containing the JMS properties). I don't think that you will be able to read the object back from the file simply using ObjectInputStream. Why don't you put that message on a test queue and read it from there?

Need Your Help

Saving an NSArray of custom objects

objective-c ios inheritance nskeyedarchiver nscoding

I've created a subclass of UIImage (UIImageExtra) as I want to include extra properties and methods.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.