Miguel Graterol
Miguel Graterol

Reputation: 11

Java: RMI issue

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

Upvotes: 0

Views: 75

Answers (1)

Deltharis
Deltharis

Reputation: 2373

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.

Upvotes: 1

Related Questions