aspose file tools*
The moose likes Java in General and the fly likes Strange Serialization issue - serialVersionUID need on an interface!?! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Strange Serialization issue - serialVersionUID need on an interface!?!" Watch "Strange Serialization issue - serialVersionUID need on an interface!?!" New topic
Author

Strange Serialization issue - serialVersionUID need on an interface!?!

David Harte
Greenhorn

Joined: Oct 17, 2002
Posts: 2
I would very much appreciate it if someone could give me their thoughts on what they think may be causing the following problem. Basically I have the following structure and am getting a local class incompatible error on the interface!

Public interface ExecutionActivity extends Serializable

Public class ExecutionActivityImpl extends AbstractObject implements ExecutionActivity �

ExecutionActivityImpl has the serialVersionUID set as follows

private static final long serialVersionUID = 1L;

I persisted objects some time back and have now changed both the interface ExecutionActivity and ExecutionActivityImpl and am getting a � �ExecutionActivity (this is an interface!); local class incompatible error : serialVersionUID = 6901�., local class serialVersionUID = 123��

I have used serialver and have confirmed that the serialVersionUID for which I am getting an error is for the Interface, is this correct? My understanding was that the serialVersionUID only needed to be set on the class.

I added the serialVersionUID to the interface and that seemed to work however I would like to confirm that this is normal behaviour. One thing to mention is that the objects were persisted using j2se 1.4.0 and read back using 1.4.2

Many thanks,

David
jiju ka
Ranch Hand

Joined: Oct 12, 2004
Posts: 306
I don't know exactly what the problem is. It seems like a version compatability issue.

I came across similar issue in the past where the version of sdk I used to compile was different than I used for run.

Your problem doesn't seem like a class compatability issue which I had. This seems like an object compatability issue.

It could be either

Objects were instantiated in one jvm and persisted. A higher version of JVM when read this persisted object, found incompatability.

OR

The .class file changed inbetween.

Please read this
http://www.javaworld.com/javaworld/javaqa/2003-06/02-qa-0627-mythser.html
 
wood burning stoves
 
subject: Strange Serialization issue - serialVersionUID need on an interface!?!