Home arrow static arrow Java Programming [Archive] - LocateRegistry.createRegistry(1099) works but "start rmiRegistry " doesn't
Warning: Creating default object from empty value in /www/htdocs/w008deb8/wiki/components/com_staticxt/staticxt.php on line 51
Java Programming [Archive] - LocateRegistry.createRegistry(1099) works but "start rmiRegistry " doesn't
This topic has 1 reply on 1 page.

Posts:346
Registered: 1/15/04
LocateRegistry.createRegistry(1099) works but "start rmiRegistry " doesn't  
Jul 21, 2004 6:35 AM



 
Hi,
If I start the RMI registry from within the main method of my remote object on my server using the line
LocateRegistry.createRegistry(1099) 
in my application
my remote object is registered and handles calls from the client with no problem

However if I try to start the RMIRegistry from the cmd line it throws a Stub not found exception and basically does nothing

any ideas why this is the case?
 

Posts:2,399
Registered: 10/26/00
Re: LocateRegistry.createRegistry(1099) works but "start rmiRegistry " doe  
Jul 21, 2004 9:21 AM (reply 1 of 1)



 
My guess is that when you create your own registry, the classloader for stubs uses the classpath (which probably includes your stubs). When you use rmiregistry, it has no clue where your classes are. When you use bind/rebind, the registry implementation uses the system property "java.rmi.server.codebase" to locate them. I experienced the same problem while testing.

so when you run your server to connect to an existing rmiregistry, pass the system property along like this:
java -Djava.rmi.server.codebase=<url to your classes> <server class>


For reference:
http://java.sun.com/docs/books/tutorial/rmi/running.html
 
This topic has 1 reply on 1 page.