Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

RMI error

 
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.
 
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?
 
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?
 
author
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?
 
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.
 
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.
 
Live ordinary life in an extraordinary way. Details embedded in this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic