Object Serialization Between JDK Versions
2 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   paul_carroll
Posted On:   Tuesday, November 15, 2011 03:48 PM

I have been using JDK 1.4 for my application. I have serialized objects stored in the database as blobs. I am updating my application so that it now requires JDK 1.6. When I try to access the serialized objects in the database, the application throws an UnmarshalException. Is it not possible to access these serialized objects once I update the JDK from 1.4 to 1.6? Thanks.

Re: Object Serialization Between JDK Versions

Posted By:   rahul123  
Posted On:   Wednesday, December 18, 2013 11:32 PM

Because jvm generated serial version UID
by default we are using these UID means custom UID. so the problem is whenever we are change our code new serial version UID is generate .
you are trying to deserialize your code then jvm is check the UID which is not found so jvm will generate error

Solution. define UID in our code
public static final long serialVersionUID =1l;

Re: Object Serialization Between JDK Versions

Posted By:   Sa_ba  
Posted On:   Saturday, December 10, 2011 01:59 PM

Are you using custom SerialversionUID. If not then try with that or else try serializing and de-serializing some Exception class object.Even exceptions are already serialized because of the fact that Throwable interface is Serializable. Read more about Exceptions and Serialization at Custom Exceptions and Serialization in Java
About | Sitemap | Contact