Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

connection refused to host: localhost;  RSS feed

 
Sylvia Wang
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I'm trying RMI in Jbuilder4, have following codes for server part. and created a policy file to grant all permessions.
but the following exception occured when I tried to run the server:
connection refused to host: localhost; nested exception is:
java.net.ConnectException: Connection refused: no further information
how to solve it ? pls help. Thanks.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
if (System.getSecurityManager() == null) {
System.setSecurityManager(new RMISecurityManager());
}
try {
HelloImpl obj = new HelloImpl();
Naming.rebind("//localhost/HelloServer", obj);
System.out.println("HelloServer bound in registry");
} catch (Exception e) {
System.out.println("HelloImpl err: " + e.getMessage());
e.printStackTrace();
}
 
Tide Zhang
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think you must write the server code like this:
Naming.rebind("HelloServer", obj);
 
Sylvia Wang
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Naming.rebind("//localhost/HelloServer", obj);
you can see from my codes.
 
Tide Zhang
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you show your client code to me!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!