Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

RMI error

 
Simon Li
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 96
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is your data a remote object?
why are you doing rmic Data?
 
Simon Li
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, Data is a remote object.
 
Daniela Ch
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

...why did you do this?
 
Victor Pan
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think that the stub file is not compatible.
Are they same, or from two compile result?
 
Peter den Haan
author
Ranch Hand
Posts: 3252
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's not the stub. Simon has not kept his FieldInfo classes in sync between client and server. Tut, tut
- Peter
 
Simon Li
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2937
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic