This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Java in General and the fly likes rmi based problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "rmi based problem" Watch "rmi based problem" New topic
Author

rmi based problem

manjeet singh
Greenhorn

Joined: Mar 22, 2001
Posts: 7
hi,
i have a problem with an rmi program.when i start the registry explicitly ,the server connects.but if i try to start the registry through program and bind it doesnt work.also the gethost(),getcodebase() doesn't work.i have to give explicitly localhost to make the program work.
any ideas.thanx beforehand.
-manjeet
Sean MacLean
author
Ranch Hand

Joined: Nov 07, 2000
Posts: 621
Perhaps a snippet of the code you use to bind (rebind) to the rmi
registry might shed a bit more light on the problem.
Sean
manjeet singh
Greenhorn

Joined: Mar 22, 2001
Posts: 7
if i go for the case a
starting the registry externally
it works
Naming.rebind("rmi://localhost/ChatServerImpl",cs);
but if i go for case b
reg=LocateRegistry.createRegistry(5050);
reg.bind("rmi://localhost/ChatServerImpl",cs)
it does't work.
also using
cs=(ChatServer)Naming.lookup("rmi//"+getCodeBase().getHost()+"/ChatServerImpl");
doesnt work.
besides this,in my chat application i am able to make the server register and give its methods to the client.but for the chat client using
UnicastRemoteObject.exportObject(this);
doesn't work.
the chat cant work if the client cant export its methods in this way.any ideas?thanks beforehand!
Doug Melzer
Ranch Hand

Joined: Mar 23, 2000
Posts: 51
If 5050 is the port number for the rmiregistry, then you should use ":5050" in your binding.
reg.bind("rmi://localhost:5050/ChatServerImpl",cs)
Doug Melzer
Ranch Hand

Joined: Mar 23, 2000
Posts: 51
Forget my last reply. The "bindname" is a user-defined string.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: rmi based problem