Search code examples
javarmi

RMI Connection Refuse connect


I have wrote an RMI Client and Server when i start then on a single PC all is working. When i start at my PC the Registry, the Server and a ChatServer.

On another PC in the Local Network I start the client, then i get the requests on the Server but after the Requests i get this Error:

Caused by: java.rmi.ConnectException: Connection refused to host: 192.168.178.49; nested exception is: java.net.ConnectException: Connection refused: connect

Does this looks like a network promission error or a rmi-programming failure ?


Solution

  • I had a similar problem recently. If the address in the message is the same machine as the machine getting the error, the response is being sent to the wrong one. You have to manually set your own

    java.rmi.server.hostname
    

    in both applications. Otherwise it is probably a routing problem, that one of the machines is simply not reachable from the other.

    Here is the link to the property: http://docs.oracle.com/javase/8/docs/technotes/guides/rmi/javarmiproperties.html