java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:

0

I am programming with Java RMI, the client-server connection works, but when implementing this code:

ArrayList<ClientInterface> clientList = new ArrayList<ClientInterface>();
...
private synchronized void doCallbacks( ) throws RemoteException
    {
        System.out.println(clientList.size());
        for (int i = 0; i < clientList.size(); i++)
        {
            System.out.println("doing "+ i +"-th callback\n");
            System.out.println(clientList.get(i));
            clientList.get(i).notifyMe("Number of registered clients="+ clientList.size());
        } // for
    } // function

this exception appears:

server@client1-VirtualBox:~/ejemplo2$ java Client
Enter how many seconds to stay registered:
40
Lookup completed
Server said hello
Exception in CallbackClient: java.rmi.ServerException: RemoteException occurred in server thread; nested exception is: 
    java.rmi.ConnectException: Connection refused to host: 127.0.1.1; nested exception is: 
    java.net.ConnectException: Connection refused (Connection refused)

This is the server's execution:

server@server-VirtualBox:~/ejemplo2$ java Server
Enter the RMIregistry port number:
1099
Callback Server ready.
Client added.
1
doing 0-th callback

Proxy[ClientInterface,RemoteObjectInvocationHandler[UnicastRef [liveRef: [endpoint:[127.0.1.1:33295](remote),objID:[-38768242:15e4f5d8717:-7ffe, -1161355477735283225]]]]]
Client added.
2
doing 0-th callback

Is there something I'm doing wrong?

    
asked by Manny Hernandez Lopez 05.09.2017 в 02:25
source

0 answers