wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes Invalid Class Exception during serialization Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Invalid Class Exception during serialization" Watch "Invalid Class Exception during serialization" New topic
Author

Invalid Class Exception during serialization

adithya narayan
Ranch Hand

Joined: Jan 05, 2009
Posts: 79

It looks like its a petty problem but i am just not able to figure it out !

I have an object which is serialiazable. It has a List of objects which is also serializable.

Structure is as follows:

I have written a test file which is sending an object of without the parameter. It works fine. But when i try to send the list along with the object then it gives me an exception :

java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
java.io.InvalidClassException: com.sungard.energy.aligne.common.model.GenericModuleDTO; local class incompatible: stream classdesc serialVersionUID = 1, local class serialVersionUID = -5463249867264383702
at weblogic.rjvm.ResponseImpl.unmarshalReturn(ResponseImpl.java:234)
at weblogic.rmi.cluster.ClusterableRemoteRef.invoke(ClusterableRemoteRef.java:348)
at weblogic.rmi.cluster.ClusterableRemoteRef.invoke(ClusterableRemoteRef.java:259)
at com.altra.pipeline.common.service.pipeline_GasOpsService_n51s6h_EOImpl_1035_WLStub.processServiceRequest(Unknown Source)
at com.pack.java.gas.common.location.CommonLocationHelperTest.main(CommonLocationHelperTest.java:241)
Caused by: java.io.InvalidClassException: com.sungard.energy.aligne.common.model.GenericModuleDTO; local class incompatible: stream classdesc serialVersionUID = 1, local class serialVersionUID = -5463249867264383702
at java.io.ObjectStreamClass.initNonProxy(ObjectStreamClass.java:562)
at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1582)
at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1495)
at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1582)
at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1495)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1731)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1328)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:350)
at java.util.ArrayList.readObject(ArrayList.java:593)
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:597)
at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:974)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1848)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1752)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1328)
at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1946)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1870)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1752)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1328)
at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1946)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1870)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1752)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1328)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:350)
at weblogic.utils.io.ChunkedObjectInputStream.readObject(ChunkedObjectInputStream.java:208)
at weblogic.rjvm.MsgAbbrevInputStream.readObject(MsgAbbrevInputStream.java:599)
at weblogic.utils.io.ChunkedObjectInputStream.readObject(ChunkedObjectInputStream.java:204)
at com.altra.pipeline.common.service.pipeline_GasOpsService_n51s6h_EOImpl_WLSkel.invoke(Unknown Source)
at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:667)
at weblogic.rmi.cluster.ClusterableServerRef.invoke(ClusterableServerRef.java:230)
at weblogic.rmi.internal.BasicServerRef$1.run(BasicServerRef.java:522)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:363)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:146)
at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:518)
at weblogic.rmi.internal.wls.WLSExecuteRequest.run(WLSExecuteRequest.java:118)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:178)



Actually the CommonLocationDTO is present inside a jar which i have included in the build path.

Structure of CommonLocationDTO
:



Am i missing something ?

Adithya.
Alexei Kaigorodov
Greenhorn

Joined: Feb 24, 2008
Posts: 17
The key message is:

java.io.InvalidClassException: com.sungard.energy.aligne.common.model.GenericModuleDTO; local class incompatible: stream classdesc serialVersionUID = 1, local class serialVersionUID = -5463249867264383702

The List locationDTOList contains an object of type GenericModuleDTO which was serialized using a version of the GenericModuleDTO class with serialVersionUID=1.
You are trying to deserialize it with a version of the GenericModuleDTO class with serialVersionUID=-5463249867264383702.
You should use classes with identical serialVersionUID.
adithya narayan
Ranch Hand

Joined: Jan 05, 2009
Posts: 79

I found the problem. My EAR was referring to two jars out of which the one i had was having correct serialversionUID's but the other one wasn't. Seems like weblogic was picking the wrong jar.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Invalid Class Exception during serialization
 
Similar Threads
EJB 3.0 deployment problem in Weblogic 10
Java client not accessing sesion bean in Jboss4.0.4
java.rmi.UnmarshalException: Help!
java.rmi.UnmarshalException: failed to unmarshal interface java.util.Set; nested exce
Weblogic 7 with jdk 1.6 - Does it support jdk 1.6?