File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Distributed Java and the fly likes NotBoundException on clientside related to Naming.lookup Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Distributed Java
Bookmark "NotBoundException on clientside related to Naming.lookup" Watch "NotBoundException on clientside related to Naming.lookup" New topic
Author

NotBoundException on clientside related to Naming.lookup

Diego Bowen
Ranch Hand

Joined: Aug 19, 2003
Posts: 50
Hello computer folks,
I've been tring to get this RMI helloworld up and running on two different machines without much success. Here is a link to the source code I've been using: http://www.umsl.edu/~siegel/course302/part3/RMI/RMI-simple.html
On the client side:
java -Djava.rmi.server.codebase=http://(serversIPaddress)/~DBowen/myRMI/
-Djava.security.policy=java.policy HelloMain
HelloApplet exception:~DBowen/myRMI/HelloServer
java.rmi.NotBoundException: ~DBowen/myRmi/HelloServer
............
at HelloMain.main(HelloMain.java 12)
here is line 12:
Hello obj = (Hello)Naming.lookup("http://theserverIP/~DBowen/myRMI/HelloServer");
I've tried various variations within the (...)
such as "//theServerIp/..."
"rmi://theSeverIP/"
All with the same results. Can someone give me a hand please???
Thanks in advance.
Chris De Vries
Ranch Hand

Joined: Dec 05, 2002
Posts: 65
You definitely should get rid of the "http:" in the Naming.lookup() method argument. What you are doing with the Naming.lookup() method is querying the RMI registry for a remote reference to an object on the server. RMI does this using the RMI protocol, so adding an "rmi:" instead of "http:" is correct, but not necessary.
You should use the same url in the lookup as you used in the Naming.rebind() call of HelloImpl, plus the server name if it was not included in the rebind call. I typically do not include the server name in the rebind call for two reasons:
  • As a security feature you can only call Naming.rebind() to bind an object to a registry running on the same machine.
  • If you move the code onto a new server, you do not have to rewrite that portion of the code.

  • Naming.lookup() definitely needs the server name to be included so it can find the machine with the UnicastRemoteObject it needs to use.
    I know this answer is confusing, and many people explain this better than I can. Try the RMI trail of Sun's java tutorial if you need more help.
    Chris
    Diego Bowen
    Ranch Hand

    Joined: Aug 19, 2003
    Posts: 50
    Hello Chris, thanks for the post...I figured out those changes and implemented them...And I was able to get the server up and running, I even checked the registry and I have "//linux:1099/~DBowen/myRMI/HelloServer" in it. However when I rn the following on the client I get the following maessae:
    java -Djava.rmi.server.codebase=httP://192.0.3.17/~DBowen/myRMI -Djava.security.policy=java.policy HelloMain
    HelloApplet exception:error unmarshalling return; nested exception is:
    java.lang.classNotfoundException: HelloImpl_Stub

    I'm really really frustrated with RMI. so can some pleaase help me...thanks
    Chris De Vries
    Ranch Hand

    Joined: Dec 05, 2002
    Posts: 65
    Originally posted by Diego Bowen:
    ... I was able to get the server up and running, I even checked the registry and I have "//linux:1099/~DBowen/myRMI/HelloServer" in it. However when I rn the following on the client I get the following maessae:
    java -Djava.rmi.server.codebase=httP://192.0.3.17/~DBowen/myRMI -Djava.security.policy=java.policy HelloMain
    HelloApplet exception:error unmarshalling return; nested exception is:
    java.lang.classNotfoundException: HelloImpl_Stub

    Do you have a regular http server running on port 80, and is "~DBowen" mapped to a directory in which you have a "myRMI" subdirectory with the file "HelloImpl_Stub.class" in it? Both the rmiregistry and the web server must be available for dynamic classloading using the hypertext transfer protocol.
     
    I agree. Here's the link: http://aspose.com/file-tools
     
    subject: NotBoundException on clientside related to Naming.lookup