*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes RMI error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "RMI error" Watch "RMI error" New topic
Author

RMI error

Simon Li
Greenhorn

Joined: Apr 08, 2002
Posts: 8
hi gurus.
I'm doing FBN project. I've run the server:
1.rmic -v1.2 suncertify.db.Data
2.start rmiregistry
3.start java suncertify.db.FlightServer db=E:\develop\scjd\server\suncertify\db\db.db
When I run the client, shows error:
java.rmi.UnmarshalException: error unmarshalling return; nested exception is:
java.io.InvalidClassException: suncertify.db.FieldInfo; Local class not compatible: stream classdesc serialVersionUID=-4980001947418265841 local class serialVersionUID=-5449000422649340349
The metod in Data.java is:
public synchronized FieldInfo [] getFieldInfo()
Could someone tells me why? Thank you.
Daniela Ch
Ranch Hand

Joined: Dec 13, 2002
Posts: 96
Is your data a remote object?
why are you doing rmic Data?
Simon Li
Greenhorn

Joined: Apr 08, 2002
Posts: 8
Yes, Data is a remote object.
Daniela Ch
Ranch Hand

Joined: Dec 13, 2002
Posts: 96

...why did you do this?
Victor Pan
Ranch Hand

Joined: May 01, 2002
Posts: 36
I think that the stub file is not compatible.
Are they same, or from two compile result?


Java makes world work!!!
Peter den Haan
author
Ranch Hand

Joined: Apr 20, 2000
Posts: 3252
It's not the stub. Simon has not kept his FieldInfo classes in sync between client and server. Tut, tut
- Peter
Simon Li
Greenhorn

Joined: Apr 08, 2002
Posts: 8
OK, I've settled the problem. I think it dues to there's an old stub in my project scjdClient's src directory. Thanks Daniela, Victor and Peter!
Another question, I use JBuilder to compile RMI project, it will clear classes directory. So if I do some change in client source code and recompile, JBuilder will delete the stub file I've copy from server to client classes directory. That means I should have to copy the stub file again and again after changing clint code. Does anybody has some good idea about it?
Brian Blignaut
Ranch Hand

Joined: Jan 08, 2003
Posts: 61
The error is as a result of your client side code not being the same version as your server side code. ie you recompiled your server but you never put the latest version of the stud on the client side. When you compile remote objects you have to keep both sides client and server in sync.
John Smith
Ranch Hand

Joined: Oct 08, 2001
Posts: 2937

Another question, I use JBuilder to compile RMI project, it will clear classes directory. So if I do some change in client source code and recompile, JBuilder will delete the stub file I've copy from server to client classes directory. That means I should have to copy the stub file again and again after changing clint code. Does anybody has some good idea about it?

I also used JBuilder, but I never had to copy the stubs from one place to another. I had both client and server source under the same project. To debug and test the client as a stand-alone, I ran it directly from JBuilder. For remote mode, I started server outside of JBulder.
Eugene.
 
 
subject: RMI error