trs trs - 21 days ago 5
Java Question

error: local class incompatible: stream classdec serialversionUID= ...., local class serialversionUID=

I have a serializable java class and when I add either of the following methods. I get this error

" local class incompatible: stream classdec serialversionUID= ...., local class serialversionUID=..."

added methods:

public HashMap<Long, BookIndex> getBookIndexMap() {
return bookIndexMap;
}

public String getDataFileName() {
return dataFileName;
}


what is causing this and how can I correct it?

Answer

This article may be helpful:

http://lingpipe-blog.com/2010/05/04/upgrading-java-classes-backward-compatible-serialization/

By changing the class's method signatures, previous serialized forms are incompatible unless the classes have the same serialVersionUID.

Comments