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
Joined: May 27, 2001
Posts: 3
posted
0
I think you must write the server code like this: Naming.rebind("HelloServer", obj);
Sylvia Wang
Ranch Hand
Joined: Apr 10, 2001
Posts: 53
posted
0
Naming.rebind("//localhost/HelloServer", obj); you can see from my codes.