Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Strange problem when chaning java version  RSS feed

 
Humpe Caballero
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

I was hoping someone could help me out with this rather strange error. I'm running a server application on a Weblogic 8.1 (Which means it runs java 1.4.2_08). I then connect to a server with a client compiled and ran with Java 1.5.0_10 which works just fine. Now I try to RUN (Not compile) the same client with Java 1.6.10_10Rc and suddenly things don't work.

The Exception I get don't tell me much and I haven't been able to find much information (That seems relevant) on the net either. But it seems to have to do with serialization some how?

I get the following Exception:

java.io.StreamCorruptedException
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1301)
at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1845)
at java.io.ObjectInputStream.defaultReadObject(ObjectInputStream.java:452)
at java.text.DecimalFormat.readObject(DecimalFormat.java:2507)
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:324)
at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:838)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1746)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1646)
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.defaultReadFields(ObjectInputStream.java:1845)
at java.io.ObjectInputStream.defaultReadObject(ObjectInputStream.java:452)
at kicore.common.model.ipvpn.ekomp.EPris.readObject(EPris.java:171)

Thanks in advance

/H
 
Martijn Verburg
author
Bartender
Posts: 3275
5
Eclipse IDE Java Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there and welcome to Javaranch,

A quick admin matter, I noticed you posted this in two threads. Please only use UseOneThreadPerQuestion.

Onto your question! Can I ask why you are trying with that version of JDK1.6? the _10 version is in Beta/RC and should not really be used as of yet...
 
Rob Spoor
Sheriff
Posts: 21092
85
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Martijn Verburg:
A quick admin matter, I noticed you posted this in two threads. Please only use UseOneThreadPerQuestion.

I think you missed the fact that I moved this thread here
The other one is closed.
 
Martijn Verburg
author
Bartender
Posts: 3275
5
Eclipse IDE Java Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Rob Prime:

I think you missed the fact that I moved this thread here
The other one is closed.


Yep! I have a bad habit of opening up a browser with ~20-30 Javaranch Q's and then slowly working through them throughout my day. I need to learn to hit the refresh button before I open My Big Mouth (Tm)
 
Joe Ess
Bartender
Posts: 9429
12
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The usual cause of a StreamCorruptedException is that one opens a stream for object reading that was not written with an object stream.
I have had problems with Weblogic 8.1 and a WLST client if WLST is run with a different java version than Weblogic. Of course, this problem causes an UnmarshalException/InvalidClassException caused by different serialVersionUID's in the different VM's classes.
You may want to catch the StreamCorruptedException and see if it has a nested exception (you can obtain it with getCause()).
In any case, my experience has made me very wary of using serialization between different VM versions.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!