InvalidClassException COM.rsa.jsafe.SunJSSE_dr

N

Nomak

Hello,

With this source code:

FileInputStream istream = new FileInputStream(fullPathFile);
ObjectInputStream oistream = new ObjectInputStream(istream);
Object o = oistream.readObject();

i get:

java.io.InvalidClassException: COM.rsa.jsafe.SunJSSE_dr; local class incompatible: stream classdesc serialVersionUID = -8679601579857181180, local class serialVersionUID = -7264885549576920566
at java.io_ObjectStreamClass.initNonProxy(ObjectStreamClass.java:463)
at java.io_ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1521)
at java.io_ObjectInputStream.readClassDesc(ObjectInputStream.java:1435)
at java.io_ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1626)
at java.io_ObjectInputStream.readObject0(ObjectInputStream.java:1274)
at java.io_ObjectInputStream.defaultReadFields(ObjectInputStream.java:1845)
at java.io_ObjectInputStream.readSerialData(ObjectInputStream.java:1769)
at java.io_ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1646)
at java.io_ObjectInputStream.readObject0(ObjectInputStream.java:1274)
at java.io_ObjectInputStream.readObject(ObjectInputStream.java:324)


This is on a linux machine, while on a windows XP, it works (with the same file pointed by "fullPathFile").

does anybody have an idea of anything which can make that happen?

linux: 1.4.2_07
windows: 1.4.2_06


Thx
 
A

Arnaud Berger

Hi,

You should probably try with the exact same version of JRE that was working
on Windows (i.e 1.4.2_06
).

The exception you got, simply means that the serialized object is not of the
same version as the COM.rsa.jsafe.SunJSSE_dr class you have in your
classpath (jre/lib/jsse.jar).

Alternatively, maybe copying the jar from your windows JRE to the linux one
could work.
But, I don't think this is an advised trick.

Regards,

Arnaud

Nomak said:
Hello,

With this source code:

FileInputStream istream = new FileInputStream(fullPathFile);
ObjectInputStream oistream = new ObjectInputStream(istream);
Object o = oistream.readObject();

i get:

java.io.InvalidClassException: COM.rsa.jsafe.SunJSSE_dr; local class
incompatible: stream classdesc serialVersionUID = -8679601579857181180,
local class serialVersionUID = -7264885549576920566
at java.io_ObjectStreamClass.initNonProxy(ObjectStreamClass.java:463)
at java.io_ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1521)
at java.io_ObjectInputStream.readClassDesc(ObjectInputStream.java:1435)
at java.io_ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1626)
at java.io_ObjectInputStream.readObject0(ObjectInputStream.java:1274)
at java.io_ObjectInputStream.defaultReadFields(ObjectInputStream.java:1845)
at java.io_ObjectInputStream.readSerialData(ObjectInputStream.java:1769)
at java.io_ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1646)
at java.io_ObjectInputStream.readObject0(ObjectInputStream.java:1274)
at java.io_ObjectInputStream.readObject(ObjectInputStream.java:324)


This is on a linux machine, while on a windows XP, it works (with the same
file pointed by "fullPathFile").
 
N

Nomak

Hi,

You should probably try with the exact same version of JRE that was working
on Windows (i.e 1.4.2_06
).

The exception you got, simply means that the serialized object is not of the
same version as the COM.rsa.jsafe.SunJSSE_dr class you have in your
classpath (jre/lib/jsse.jar).

Alternatively, maybe copying the jar from your windows JRE to the linux one
could work.
But, I don't think this is an advised trick.


Thx, i did copy the jsse.jar from windows to linux and it works. But i can't ask to all our customers to have an exact version of the jdk. How can it be handled?

More surprising is that other developpers (all using windows) can read the file with (jse1.5). How can it be explained? (my boss don't believe is a jdk version problem).

Is there a jdk-version-serialVersionUID-map somewhere in the jdk that we don't use?
 
A

Arnaud Berger

Hi,

There are two mechanisms for attributing a serial version :

Either it is written in the code as a
public final static long serialVersionUID=......;
or it is automatically generated , based on the methods defintions and
variables of the class.

There is a tool , "serialver" in JDK's bin directory, that tells you about
the version of a class :

e.g

serialver -classpath "jre"/lib/jsse.jar COM.rsa.jsafe.SunJSSE_dr .

You should try this with different JREs' jsse.jar to see which ones have
the same version for SunJSSE_dr .

I think there is no way to change the version of this class by yourself.

Regards,

Arnaud


Nomak said:
Thx, i did copy the jsse.jar from windows to linux and it works. But i
can't ask to all our customers to have an exact version of the jdk. How can
it be handled?
More surprising is that other developpers (all using windows) can read the
file with (jse1.5). How can it be explained? (my boss don't believe is a jdk
version problem).
 
A

Arnaud Berger

Just a last note,

You may want to provide your serialized object to your customers , for any
JDK they may use.

Say obj_1-4-2_06.ser, obj_1-4-2_07.ser, obj_1-5-1.ser...

Not a great solution, but still...

Regards,

Arnaud



Nomak said:
Thx, i did copy the jsse.jar from windows to linux and it works. But i
can't ask to all our customers to have an exact version of the jdk. How can
it be handled?
More surprising is that other developpers (all using windows) can read the
file with (jse1.5). How can it be explained? (my boss don't believe is a jdk
version problem).
 
G

Gordon Beaton

FileInputStream istream = new FileInputStream(fullPathFile);
ObjectInputStream oistream = new ObjectInputStream(istream);
Object o = oistream.readObject();

i get:

java.io.InvalidClassException: COM.rsa.jsafe.SunJSSE_dr; local class
incompatible: stream classdesc serialVersionUID =
-8679601579857181180, local class serialVersionUID =
-7264885549576920566

The communicating processes see two different versions of the classfile.

/gordon
 
N

Nomak

Hi,

There are two mechanisms for attributing a serial version :

Either it is written in the code as a
public final static long serialVersionUID=......;
or it is automatically generated , based on the methods defintions and
variables of the class.

There is a tool , "serialver" in JDK's bin directory, that tells you about
the version of a class :

e.g

serialver -classpath "jre"/lib/jsse.jar COM.rsa.jsafe.SunJSSE_dr .

You should try this with different JREs' jsse.jar to see which ones have
the same version for SunJSSE_dr .

I think there is no way to change the version of this class by yourself.

jar version which comes from windows:

$ JDK=/usr/java/j2sdk1.4.2_07
$ serialver -classpath $JDK/lib/jsse.jar COM.rsa.jsafe.SunJSSE_dr
COM.rsa.jsafe.SunJSSE_dr: static final long serialVersionUID = -8679601579857181180L;


original jar version:

$ serialver -classpath ./jsse_OLD.jar COM.rsa.jsafe.SunJSSE_dr
COM.rsa.jsafe.SunJSSE_dr: static final long serialVersionUID = -8679601579857181180L;

It's the same id. The error message was:

java.io.InvalidClassException: COM.rsa.jsafe.SunJSSE_dr; local class incompatible: stream classdesc serialVersionUID = -8679601579857181180, local class serialVersionUID = -7264885549576920566

Who can i know to which class/jdk-version does "-7264885549576920566" is mapped to?
 
A

Arnaud Berger

Hi,

This is pretty strange, I just tried a serialver pointing to the class of
1.4 and then to the class of 1.5.
The result is :

in both cases , it returns me the ID of ITS JRE (from the JDK where
serialver was found)

So, for each JRE, try to use its won serialver tool :

/usr/java/j2sdk1.4.2_07/bin/serialver COM.rsa.jsafe.SunJSSE_dr
/usr/java/j2sdk1.4.2_06/bin/serialver COM.rsa.jsafe.SunJSSE_dr
/usr/java/j2sdk1.5.0/bin/serialver COM.rsa.jsafe.SunJSSE_dr

Regards,

Arnaud


Nomak said:
jar version which comes from windows:

$ JDK=/usr/java/j2sdk1.4.2_07
$ serialver -classpath $JDK/lib/jsse.jar COM.rsa.jsafe.SunJSSE_dr
COM.rsa.jsafe.SunJSSE_dr: static final long serialVersionUID = -8679601579857181180L;


original jar version:

$ serialver -classpath ./jsse_OLD.jar COM.rsa.jsafe.SunJSSE_dr
COM.rsa.jsafe.SunJSSE_dr: static final long serialVersionUID = -8679601579857181180L;

It's the same id. The error message was:

java.io.InvalidClassException: COM.rsa.jsafe.SunJSSE_dr; local class
incompatible: stream classdesc serialVersionUID = -8679601579857181180, loca
l class serialVersionUID = -7264885549576920566
 
N

Nomak

Hi,

This is pretty strange, I just tried a serialver pointing to the class of
1.4 and then to the class of 1.5.
The result is :

in both cases , it returns me the ID of ITS JRE (from the JDK where
serialver was found)

So, for each JRE, try to use its won serialver tool :

/usr/java/j2sdk1.4.2_07/bin/serialver COM.rsa.jsafe.SunJSSE_dr
/usr/java/j2sdk1.4.2_06/bin/serialver COM.rsa.jsafe.SunJSSE_dr
/usr/java/j2sdk1.5.0/bin/serialver COM.rsa.jsafe.SunJSSE_dr


well, another developper did this on his jdk (1.5) on windows, and he found the same id.

I don't understand what's happening.
 
A

Arnaud Berger

Maybe you should serialize the object with 1.4.2_07 and try to deserialize
with several different JREs.

Regards,

Arnaud

Nomak said:
thx but it's not the case, it was done with 1.4

the one with jse 1.5 uninstalled its jdk, and installed 1.4.2_07 instead,
and now he's having the same problem.
 

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,731
Messages
2,569,432
Members
44,832
Latest member
GlennSmall

Latest Threads

Top