0
votes

Hi im trying to connect a client-server application in Java with RMI, in the client i have this

public static void main (String[] args)
{
    try
    {
        Registry registro = LocateRegistry.getRegistry("192.168.1.19",1099);
        System.out.println("Cliente esta Corriendo");

    }
    catch (Exception e)
    {
        System.out.println(e);
    }
    ClienteERI consumir = new ClienteERI();
    consumir.sumaRemota(2, 3);
}

and in the server i have this

public static void main(String[] args) {
      try {
        Registry registro = LocateRegistry.createRegistry(1091);
        registro.rebind("servidor", new ServidorERI());
        System.out.println("Servidor esta corriendo");
    } catch (Exception e){
        System.out.println(e);
    }
}

but in the client i have this exception

java.rmi.ConnectException: Connection refused to host: 127.0.1.1; nested exception is: java.net.ConnectException: Connection refused: connect

and in the client i have the server address correctly (i have check the server addres for a houndred times)

please som

1
could be a firewall issue - Daniel A. White
Why is the registry unused in the client? - user207421

1 Answers

1
votes

You were correct in trying to check the address a hundred times. The error IS there.

client:

LocateRegistry.getRegistry("192.168.1.19",1099);

server:

LocateRegistry.createRegistry(1091);

These ports need to match.