Вопрос

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