Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Connection Exception with RMI  RSS feed

 
Kumar Kausikasa
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ,
I have written a simple "HelloWorld", using RMI. The program works fine when in run both client and server on the same machine.
But when i run client on a different machine, i get connectionException.
I have checked the policy file and that seems to be ok, i mean no restriction.
Serverside rebind code:
LocateRegistry.createRegistry(2002);
Registry registry = LocateRegistry.getRegistry(2002);
registry.rebind("Hello", obj);
System.out.println("HelloImpl bound in registry");
client side look-up code:
Registry registry = LocateRegistry.getRegistry(2002);
Hello obj = (Hello)registry.lookup("//134.168.56.47:2002"+"/Hello");
String message = obj.sayHello();
System.out.println(message);
Can some one tell me what i am doing wrong ?
TIA
praveen.
 
Cindy Glass
"The Hood"
Sheriff
Posts: 8521
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moving to the RMI forum (Distributed Java).
 
Vinod John
Ranch Hand
Posts: 162
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This could not a security exception, so you don't have to make changes in the policy file.
Did you try using the machine name (DNS name)instead of the ip address, when you look up for the remote interface.
Let me know if you fix it and also how you fixed it.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!