Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Runtime error while registering Remote object

 
jayashree murugan
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm working on Unix. I've started the RMI Registry. When loading the Remote Object, I get this error.
-------------------------------------------
RemoteException occurred in server thread; nested exception is:
java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
java.lang.ClassNotFoundException: MyServerImpl_Stub
-------------------------------------------
The skeleton and stub classes have been generated and are present in the same directory. I don't understand why it is asking for the stub while registering the server object. The stub is required only by the client ... isn't it?


[This message has been edited by jayashree murugan (edited July 12, 2000).]
 
Carl Trusiak
Sheriff
Posts: 3341
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by jayashree murugan:
I'm working on Unix. I've started the RMI Registry. When loading the Remote Object, I get this error.

Well, I maybe wrong but, RMI is dual communication. A stub defines how an object is sent and the skeleton defines how an object is recieved. Your client sends an object through the stub, the server recieves it through the skeleton. Once the server completes it's processing it sends the response through the STUB and your client recieves it through the SKELETON. The definitions for both communications is in one stub and one skeleton therefore a copy of the same stub and skeleton are required on both ends!
 
Milind Kulkarni
Ranch Hand
Posts: 146
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
On making a call to the registry to bind the object, the registry actually binds a reference to the stub for the remote object. In order to instantiate a stub object, the registry VM needs to be able to load its class definition. The VM (in this case the server VM) that sends the serialized forms of a stub in a remote method call to the registry is responsible for annotating the stub with the location from which its classes can be downloaded. If stubs are not annotated properly, RMI will throw a ClassNotFoundException when it tries to instantiate the stub.
Check the following:
1> Value of To java.rmi.server.codebase property is set to the locations of the stub
2> It is possible that to enable the rmiregistry to unmarshal stub objects by placing all relevant stub class files in the CLASSPATH of the rmiregistry. However, the rmiregistry does not have to download stub classes. If stub classes are available locally, it will use those classes.
Something wierd:
I got a similar type of exception on my WIN 98 machine but if I invoke the Internet then problem seem to have gone.
Regards,
Milind

 
jayashree murugan
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Milind, I've just started working on Java in the Unix Environment. I don't know Unix very well. I'm used to working on Windows. So I'll have to ask you very basic questions.
---------------------------------------------
"1> Value of To java.rmi.server.codebase property is set to the locations of the stub"
How do I set the codebase property?
---------------------------------------------
2> It is possible that to enable the rmiregistry to unmarshal stub objects by placing all relevant stub class files in the CLASSPATH of the rmiregistry. However, the rmiregistry does not have to download stub classes. If stub classes are available locally, it will use those classes.
How do I set the CLASSPATH of the rmiregistry?
----------------------------------------
Regards,
Jayashree

[This message has been edited by jayashree murugan (edited July 13, 2000).]
 
Milind Kulkarni
Ranch Hand
Posts: 146
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Jayashree,
Check out this URL for setting codebase property:
http://java.sun.com/products/jdk/1.2/docs/guide/rmi/codebase.html
Setting CLASSPATH for rmiregistry is no different from setting CLASSPATH to point to working directory.
Regards,
Milind
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic