lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jason Rutherglen" <jason.rutherg...@gmail.com>
Subject Re: serialVersionUID issue between 2.3 and 2.4
Date Tue, 02 Dec 2008 01:54:04 GMT
> if you don't set serialVersionUID yourself, then java assigns a
rather volatile one for you

True however the Java specification defines how the serialVersionUID should
be created in the event it's not defined.  The caveat being it's not
strictly enforced and so Sun alternative compilers may decide to change how
it's created (from what I've read).  Base classes like Term and Query don't
change very often so we may want to settle on a serialVersionUID for these
top level classes.

Was a different compiler used for the 2.4 release compared to 2.3?

On Mon, Dec 1, 2008 at 5:43 PM, Michael McCandless <
lucene@mikemccandless.com> wrote:

>
> Well.. if you don't set serialVersionUID yourself, then java assigns a
> rather volatile one for you so that it doesn't attempt to deserialize
> to an incompatible local class.
>
> We could assign one ourselves, and then we have to remember to change
> it if we ever make a big enough change to Term, to allow serialize in
> one version of Lucene & deserialize in another.
>
> Mike
>
>
> Jason Rutherglen wrote:
>
>  Seeing the following issue between Lucene 2.3 and 2.4. A 2.3 serialized
>> Term
>> object cannot be deserialized by 2.4.  I would guess it has something to
>> do
>> with a different Java compiler being used for the Lucene 2.4 build as
>> serialVersionUID is not defined in the Term class.  Fixing the issue is
>> critical for a release before the holidays.
>>
>> The stacktrace below details the error.
>>
>> Exception in thread "main" java.io.InvalidClassException:
>> org.apache.lucene.index.Term; local class incompatible: stream classdesc
>> serialVersionUID = 554776219862331599, local class serialVersionUID =
>> 435090971444481257
>>
>>       at
>> java.io.ObjectStreamClass.initNonProxy(ObjectStreamClass.java:546)
>>       at
>> java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1552)
>>       at
>> java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1466)
>>       at
>> java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1699)
>>       at
>> java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1305)
>>       at
>> java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1908)
>>       at
>> java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1832)
>>       at
>> java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1719)
>>       at
>> java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1305)
>>       at
>> java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1908)
>>       at
>> java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1832)
>>       at
>> java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1719)
>>       at
>> java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1305)
>>       at java.io.ObjectInputStream.readObject(ObjectInputStream.java:348)
>>       at java.util.ArrayList.readObject(ArrayList.java:591)
>>       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>       at
>>
>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>
>>       at
>>
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>
>>       at java.lang.reflect.Method.invoke(Method.java:585)
>>       at
>> java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:946)
>>       at
>> java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1809)
>>       at
>> java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1719)
>>       at
>> java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1305)
>>       at
>> java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1908)
>>       at
>> java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1832)
>>       at
>> java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1719)
>>       at
>> java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1305)
>>       at java.io.ObjectInputStream.readObject(ObjectInputStream.java:348)
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message