The moose likes I/O and Streams and the fly likes getting around an invalidClassException Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » I/O and Streams
Reply Bookmark "getting around an invalidClassException" Watch "getting around an invalidClassException" New topic
Author

getting around an invalidClassException

Paul Bailey
Ranch Hand

Joined: Oct 20, 2000
Posts: 91
I'm getting an InvalidClassException when i read in an object, when i first open the object input stream.
i.e. i have a class that i worte forever and a day ago, and i was saving files with one of these serialized in it, and then recently, i added an extractor to the class, and now when i even try to open an object input stream with one of these it gets mad and says java.io.InvalidClassException: my.class.name.here; local class incompatible: stream classdesc serialVersionUID = 13457817857854345, local classserialVersionUID = 23523513453453245
what can i do?
i don't care about reading in this class, i just want the rest of the stuff to go through an object input stream.
Any ideas?
Paul Bailey
Ranch Hand

Joined: Oct 20, 2000
Posts: 91
The answer is here
http://www.acm.org/crossroads/xrds4-2/serial.html
one simply has to include a line like this
 
 
subject: getting around an invalidClassException
 
Threads others viewed
InvalidClassException
Annoying Hibernate serialization
serialization
InvalidClass Exception in javax .crypto. spec.SecretKeySpec
Deserialization problem - InvalidClass w/ negative serialVersionUid for local class
developer file tools