InvalidClassException!

R

Raga

Hi,

When executing a class am getting this exception:

java.io.InvalidClassException: package1.Queries; local class
incompatible: stream classdesc serialVersionUID = 7965341194343831580,
local class serialVersionUID = -3010695744043114199

Any idea how to solve this? In fact, I didnt even change anything in
this class before I got this exception.

Thanks.
 
O

opalpa

The java virtual machine is indicating that it believes there are two
versions of a class in play at the same time.

Does the class read saved objects (saved by serialization)?
Does the class use RMI?

Opalinski
(e-mail address removed)
http://www.geocities.com/opalpaweb/
 
R

Raga

O OK. Thanks a lot. But how do I make the JVM understand that there is
only one version of the class?

Nope, the class doesn't use RMI nor does it has to do anything with
serialized objects. It just manipulates some hashtables.

Thanks.
 
R

Raga

sorry,...just noticed. The class implements Serializable. Now what can
I do to solve the problem?

Thanks.
 
T

Tim Hallwyl

Raga said:
When executing a class am getting this exception:

java.io.InvalidClassException: package1.Queries; local class
incompatible: stream classdesc serialVersionUID = 7965341194343831580,
local class serialVersionUID = -3010695744043114199

Are you serializing the class? You can declare your own serialVersionUID
to avoid conflicts between recompiled versions. Just add

private static final long serialVersionUID = 1;

to your serializable classes. ...and recompile everything.

--tim
 
R

Raga

Hi,

Thanks to all of you for your valuable inputs!

I got it fixed. The exception msg had a serialVersionUID in it. I used
it as the serialVersionUID of the class by specifying the foll. line in
the class:

static final long serialVersionUID = -3010695744043014199L;

& it worked! :)


Thanks.
 
A

Andrea Desole

Raga said:
Hi,

Thanks to all of you for your valuable inputs!

I got it fixed. The exception msg had a serialVersionUID in it. I used
it as the serialVersionUID of the class by specifying the foll. line in
the class:

static final long serialVersionUID = -3010695744043014199L;

& it worked! :)

Although this is a good solution, maybe

static final long serialVersionUID = 1L;

would be better :)
The meaning of serialVersionUID, by the way, is that you are able to
identify different versions. You should think of a numbering convention.
Just using random numbers might give you a problem.
 
T

Tor Iver Wilhelmsen

Andrea Desole said:
The meaning of serialVersionUID, by the way, is that you are able to
identify different versions. You should think of a numbering
convention. Just using random numbers might give you a problem.

Well, "identify" as in "get an annoying exception instead of the
actual data". So adding serialVersionUID becomes a necessary nuisance.

A useful versioning field would be instance data, and you could test
on it in redObject() and/or writeObject() and act accordingly (e.g. by
"upgrading" the data to ra new version before passing it on).
 
Joined
Aug 22, 2007
Messages
2
Reaction score
0
how to solve this

java.io.InvalidClassException: ch.ecma.csta.binding.UniversalFailure; local class incompatible: stream classdesc serialVersionUID = -3631400319067888592, local class serialVersionUID = -4780071803391717100
at java.io_ObjectStreamClass.initNonProxy(Unknown Source)
at java.io_ObjectInputStream.readNonProxyDesc(Unknown Source)
at java.io_ObjectInputStream.readClassDesc(Unknown Source)
at java.io_ObjectInputStream.readNonProxyDesc(Unknown Source)
at java.io_ObjectInputStream.readClassDesc(Unknown Source)
at java.io_ObjectInputStream.readOrdinaryObject(Unknown Source)
at java.io_ObjectInputStream.readObject0(Unknown Source)
at java.io_ObjectInputStream.defaultReadFields(Unknown Source)
at java.io_ObjectInputStream.readSerialData(Unknown Source)
at java.io_ObjectInputStream.readOrdinaryObject(Unknown Source)
at java.io_ObjectInputStream.readObject0(Unknown Source)
at java.io_ObjectInputStream.readObject(Unknown Source)
at com.avaya.mvcs.proxy.XmlGatewayClient.handleRequest(XmlGatewayClient.java:271)
at com.avaya.mvcs.proxy.Pipeline.handleRequest(Pipeline.java:353)
at com.avaya.mvcs.proxy.ClientProxy.routeRequest(ClientProxy.java:501)
at com.avaya.mvap.svcproxy.ServiceProxy.marshallRequest(ServiceProxy.java:277)
at com.avaya.mvap.svcproxy.DeviceServicesProxy.getDeviceID(DeviceServicesProxy.java:131)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,733
Messages
2,569,439
Members
44,829
Latest member
PIXThurman

Latest Threads

Top