• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

RMI InvalidClassCastException

 
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

I am using a class that has an RMI call in it. When I attempt to debug everything executes as expected until the object is returned. When the contract object returns, I recieve an error like this:

java.io.InvalidClassException: com.dn.lca.dataobjects.Contract; local class incompatible: stream classdesc serialVersionUID = -7475071795924394977, local class serialVersionUID = -3554625892121869643>
org.springframework.remoting.RemoteConnectFailureException: Cannot connect to remote service [rmi://localhost:1199/RemoteService]; nested exception is java.rmi.UnmarshalException: error unmarshalling return; nested exception is:
java.io.InvalidClassException: com.dn.lca.dataobjects.Contract; local class incompatible: stream classdesc serialVersionUID = -7475071795924394977, local class serialVersionUID = -3554625892121869643
Caused by:
java.rmi.UnmarshalException: error unmarshalling return; nested exception is:
java.io.InvalidClassException: com.rn.mca.dataobjects.Contract; local class incompatible: stream classdesc serialVersionUID = -7475071795924394977, local class serialVersionUID = -3554625892121869643
at sun.rmi.server.UnicastRef.invoke(Unknown Source)
at org.springframework.remoting.rmi.RmiInvocationWrapper_Stub.invoke(Unknown Source)
at org.springframework.remoting.rmi.RmiClientInterceptor.doInvoke(RmiClientInterceptor.java:400)
at org.springframework.remoting.rmi.RmiClientInterceptor.doInvoke(RmiClientInterceptor.java:344)
at org.springframework.remoting.rmi.RmiClientInterceptor.invoke(RmiClientInterceptor.java:259)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:176)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:210)
at $Proxy4.generateRenewalContract(Unknown Source)
at com.rn.mca.client.service.RenewalGenServiceImpl.generateRenewalContract(RenewalGenServiceImpl.java:52)
at com.rn.mca.ui.wizard.WizardController$7.run(WizardController.java:610)
at java.lang.Thread.run(Unknown Source)
Caused by: java.io.InvalidClassException: com.rn.mca.dataobjects.Contract; local class incompatible: stream classdesc serialVersionUID = -7475071795924394977, local class serialVersionUID = -3554625892121869643
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.readObject(Unknown Source)
at sun.rmi.server.UnicastRef.unmarshalValue(Unknown Source)
... 11 more

I have checked my jar files and they all have the same time stamp. I have used a decompiler to check the compiled classes as well with the same findings. I am currently using eclipse europa to debug this issue and haven't been able to come up with anything that makes much sense. I have heard about the serialver tool but I have been having alot of trouble using it. Are there any other alternatives that provide a entry level guy a more faster way to determine what versions the compiler is seeing?

Thanks for your help!!
 
Bartender
Posts: 1638
IntelliJ IDE MySQL Database Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Do you have this class somewhere else in either the server/client classpath?
It may be that one of them is picking an older version of the class from the classpath.
It looks pretty clear that either the server or the client has an incompatible class version.
If both the client and server code is yours and you can afford to do a clean build of all the jars then that will be the best way of getting out of all this!
I would suggest cleaning up the classpath also as in remove the jars that you do not require.
reply
    Bookmark Topic Watch Topic
  • New Topic