Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

rmi based problem

 
manjeet singh
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 621
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Forget my last reply. The "bindname" is a user-defined string.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic