• Post Reply Bookmark Topic Watch Topic
  • New Topic

Cant find Stub class  RSS feed

 
Dan Lynch
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey,

Im still trying to get a simple RMI example to work. Ive gotten to the point of running the server. But im getting the following error.

java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
java.lang.ClassNotFoundException: Hello_Stub

Why cany the Server class see the Stub in the same folder. I even tried to run it with the -classpath . and - classpath (fullpath) but to no avail. Any help welcomed!

Dan
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Set it using the -Djava.rmi.server.codebase property. The value has to be a URL, so if your class is in the C:\code\myrmiprog directory, the URL's going to look like this -



The problem isn't that your *server* can't find the stub, the problem is that the *rmi registery* (which is running in a different JVM) can't find the stub when your server tries to register. The codebase property acts kind of like a "remote classpath" in this case.
 
Dan Lynch
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a million, I finally got it working.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!