5

I have updated my java version from 1.6 to 1.8. When I try to deploy my project in weblogic (12c), I am getting below error.

java.io.InvalidClassException: org.springframework.beans.PropertyAccessException; local class incompatible: stream classdesc serialVersionUID = -5171479712008793097, local class serialVersionUID = 736080306599024264

Do I need to re generate serialVersionUID , which created using java version 1.6 ?

Please help

Thanks,

Raj

1 Answer 1

2

Yes, the compiler version matters. The Serializable Javadoc says (in part)

If a serializable class does not explicitly declare a serialVersionUID, then the serialization runtime will calculate a default serialVersionUID value for that class based on various aspects of the class, as described in the Java(TM) Object Serialization Specification. However, it is strongly recommended that all serializable classes explicitly declare serialVersionUID values, since the default serialVersionUID computation is highly sensitive to class details that may vary depending on compiler implementations, and can thus result in unexpected InvalidClassExceptions during deserialization.

Sign up to request clarification or add additional context in comments.

2 Comments

However in practice if this ever happened it would break the world. I've never seen it in 22 years.
And in any case the dependency is on the compiler, so all installations of the same compiled .class file can be expected to yield the same serialVersionUID regardless of user JVM version.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.