Отказ в соединении с хостом: localhost - PullRequest
0 голосов
/ 10 ноября 2018
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);
    }
...