Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Deserialization error in JMS  RSS feed

 
magesh sripathy
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
MY scenario is:

(1) My queue has old JMS object Message .Lets say the message in the queue has the serialized object of type class mail
(2)Due to a new requirement I have added a new method to the class mail
(3)Now if try to retrive the object mail from the old message in the queue,I get a "weblogic.jms.common.JMSException: Error deserializing object(local class incompatible: stream classdesc serialVersionUID = 500568024477408449, local class serialVersionUID = 3652857871964423418
)" .

Is there is any mechanism to overcome this since my requirement demands me to add a new method to the mail class.

Can any one please help me out .

Regards,

Magesh.S
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You will have to delete the old messages from your queue.

Serialization works based on a serialVersionUID which you can supply in your class. If you don't, the JVM calculates one based on the fields and methods of the class. So if you change these the numbers will no longer match.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!