java.rmi.ConnectException: Connection refused to host: localhost;
nested exception is:
java.net.ConnectException: Connection refused: connect
服务器代码:
TaxService taxService = new TaxService();
Registry registry = LocateRegistry.createRegistry(8889);
registry.bind("TaxService", taxService);
System.out.println("The server started");
客户代码:
Registry registry = null;
try {
registry = LocateRegistry.getRegistry("localhost", 8889);
} catch (RemoteException e1) {
e1.printStackTrace();
}
ITaxService taxService = null;
try {
taxService = (ITaxService) registry.lookup("TaxService");
} catch (RemoteException e) {
System.out.println(e);
}