• Post Reply Bookmark Topic Watch Topic
  • New Topic

local class incompatible  RSS feed

Amit Chohan
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello once again
In the following peice of code i am trying to open a file 'test.obj' that contains the details of a diary ArrayList.
I want to open it, iterate through it then add each appointment to another ArrayList. But i getting an error
here's the code

but i get the error -
local class incompatible: stream classdesc serialVersionUID = 353868268248998826, local class serialVersionUID = -3889506977497366596
Any ideas? thank you
Maulin Vasavada
Ranch Hand
Posts: 1873
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi Amit,
i guess the problem is that - the object you are trying to read back (the serialize object) is facing a Versioning Problem. to let you know what i remember is,
when a class file is created then a SUID (Serial Version Unique ID) is generated for it and when you de-serialize it , JVM tries to match SUID with the SUID for the .class file it finds in CLASSPATH.
1. if we have Test.class file generated on Server upon compilation and we have the Test.class file on the client as well (just an example).
2. The server serializes the Test object and the client de-serializes it.
3. Client has Test.class in its CLASSPATH as well.
in Step-2, when client JVM de-serialize the object, it tries to match SUID of Test.class from Server and Test.class of client. if both the IDs match then there is no problem but if they don't match then its a problem. JVM will give you the error you are getting.
can you see what i mean?
- let say Client has Test.class copy generated at time-1 (upon downloading it from Server machine).
- now, after time-1, Test.class is changed (by changing the Test object impl).
- in this case new SUID for Test.class is generated on Server side and as a result Test.class's SUID (which was for the older Version of Test.class) doesn't match with Server Test.class's SUID and JVM gives the error at RunTime on Client side.
to avoid this problem we can use "serialver" program provided with JDK.
you can look at,
jGuru FQA
for more information and try God Goole for more.
hope i didn't screw your mind more :-)
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!