cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Have a PTC product question you need answered fast? Chances are someone has asked it before. Learn about the community search. X

Exception - local class incompatible: stream classdesc serialVersionUID

MP_10433217
10-Marble

Exception - local class incompatible: stream classdesc serialVersionUID

I am using Windchill PDMLink Release 12.0 and Datecode with CPS 12.0.0.1

Getting below error when defining class as serilizable

Suppressing internal message (wt.pom.pomResource/0) wt.pom.PersistenceException: A persistence error occurred. System message follows:
Nested exception is: wt.pom.DatastoreException: A SQL error has occurred. Database system message follows:
Nested exception is: java.io.InvalidClassException: local class incompatible: stream classdesc serialVersionUID = -4417239417148031805, local class serialVersionUID = 1
ACCEPTED SOLUTION

Accepted Solutions

I have received below inputs from PTC to resolve this issue. We should not be modifying serialized class once we assign serialVersionUID

.

Root Cause:

  • If we do not define serialVersionUID in Java class, Java will give a default value and every change of the class will have a new value.
  • Then the serialized Java object created with old class will fail to deserialize with new class, because the difference of the serialVersionUID.

 

The Best Practice as you did:

  • Always define serialVersionUID as 1
  • Never delete any attribute if change the class later, or else the Java object will be failed to deserialize, because the new class has no such attribute.

View solution in original post

3 REPLIES 3
avillanueva
22-Sapphire II
(To:MP_10433217)

There are a number of articles that have this message in it. Is this a new upgrade or related to some customization?

https://www.ptc.com/en/support/article/CS357861?source=search

See if above article is related.

Hi @MP_10433217,

 

I wanted to follow up with you on your post to see if your question has been answered. 
If so, please mark the appropriate reply as the Accepted Solution. 
Of course, if you have more to share on your issue, please let the Community know so that we can continue to help you. 

 

Thanks,
Anurag

I have received below inputs from PTC to resolve this issue. We should not be modifying serialized class once we assign serialVersionUID

.

Root Cause:

  • If we do not define serialVersionUID in Java class, Java will give a default value and every change of the class will have a new value.
  • Then the serialized Java object created with old class will fail to deserialize with new class, because the difference of the serialVersionUID.

 

The Best Practice as you did:

  • Always define serialVersionUID as 1
  • Never delete any attribute if change the class later, or else the Java object will be failed to deserialize, because the new class has no such attribute.
Announcements


Top Tags