This week's giveaway is in the Cloud/Virtualization forum.
We're giving away four copies of Production-Ready Serverless (Operational Best Practices) and have Yan Cui on-line!
See this thread for details.
Win a copy of Production-Ready Serverless (Operational Best Practices) this week in the Cloud/Virtualization 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
  • Liutauras Vilda
  • Bear Bibeault
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Junilu Lacar
  • Paul Clapham
  • Knute Snortum
Saloon Keepers:
  • Stephan van Hulst
  • Ron McLeod
  • Tim Moores
  • salvin francis
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Vijitha Kumara

RMI "hello world" attempt  RSS feed

 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Having a little trouble starting my server. Any help is greatly appreciated. Thanks in advance! Following is the details:

d:\Java\public_html\classes\rmi\hello
Hello.class
HelloClient.class
HelloServer.class
HelloServer_Stub.class

All java source code has the following package statememt:
package rmi.hello;

Source for HelloServer had the following:
Naming.rebind("//localhost/HelloServer", obj);

Following is the dos commands I am running:
D:\> start rmiregistry
D:\Java\public_html\classes> java -Djava.rmi.server.codebase=http://localhost/HelloServer/ -Djava.security.policy="C:\Program Files\Java\jdk1.5.0\jre\lib\security\javaRMI.policy" rmi.hello.HelloServer

Error is(not all lines included):
java.rmi.UnmarshalException: error unmarshalling arguments; nested excep
tion is:
java.lang.ClassNotFoundException: rmi.hello.HelloServer_Stub
java.rmi.ServerException: RemoteException occurred in server thread; nested exce
ption is:
java.rmi.UnmarshalException: error unmarshalling arguments; nested excep
tion is:
java.lang.ClassNotFoundException: rmi.hello.HelloServer_Stub
at sun.rmi.server.UnicastServerRef.oldDispatch(UnicastServerRef.java:385
)

Thanks!
 
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Codebase is like the classpath - if you have a http server running with a jar file out there somewhere, you can point to it using a HTTP:// URL and the RMI client will download it dynamically. If (in your case) it's a file on the machine somewhere you can use file:///C:/whatever/ to point to it. From the example command line you gave, it looks like you're confusing the codebase and the name in the RMI naming server where your instance is bound.
 
Jeff Hinshaw
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks, makes perfect sense, but I didn't see that stated anywhere. Does that mean I also need to do the same for the rebind statement?

Thanks!
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The argument to rebind (and lookup, and bind) deals with *where* to bind (or find, in the case of lookup) the *running instance* of the service you want, and it looks something like this:

If you leave off the protocol portion it assumes it's "rmi://". If you leave off the address portion it assumes it's "localhost". If you leave off the port portion it assumes it's ":1099". The name portion is always required.

Think of the RMI registry like this... a set of hashtables, each running on a different machine. The "rmi://address:port/" points to the specific hashtable/machine, and the "name" portion provides a "key" to the service you want.
[ March 15, 2005: Message edited by: Nathan Pruett ]
 
I am mighty! And this is a mighty small ad:
global solutions you can do in your home or backyard
https://coderanch.com/t/708587/global-solutions-home-backyard
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!