I had saved one java object in the Database and then after few days I changed my jre version. Now when i tried to read that same object I am getting following exception:

Exception in thread "main" java.io.InvalidClassException:
SerializeMe; local class incompatible: stream classdesc
serialVersionUID = -6377573678240024862, local class serialVersionUID = -8204757486033751616

How can I get rid of this,how can I get the saved object?

please help me.

有帮助吗?

解决方案

If you can affect source code of this class and JRE was only thing that changed, most likely you can still deserialize object that was serialized by older JVM. Just define following field in class to be deserialized:

private static final long serialVersionUID = -6377573678240024862L;
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top