Note that there are some explanatory texts on larger screens.

plurals
  1. POjava RMI connection to server
    primarykey
    data
    text
    <p>I have a very simple rmi client / server application. I don't use the "rmiregistry" application though, I use this to create the server:</p> <pre><code>server = new RemoteServer(); registry = LocateRegistry.createRegistry(PORT); registry.bind("RemoteServer", server); </code></pre> <p>The client part is:</p> <pre><code>registry = LocateRegistry.getRegistry(IPADDRESS, PORT); remote = (IRemoteServer) registry.lookup("RemoteServer"); </code></pre> <p>Here is the fascinating problem: The application works perfectly when both server and client are running in my (private) local network. As soon as I put the server on a public server, the application hangs for a minute, then gives me the following error: </p> <pre><code>java.rmi.ServerException: RemoteException occurred in server thread; nested exception is: java.rmi.ConnectException: Connection refused to host: 192.168.x.y; nested exception is: java.net.ConnectException: Connection timed out: connect at sun.rmi.server.UnicastServerRef.dispatch(Unknown Source) at sun.rmi.transport.Transport$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at sun.rmi.transport.Transport.serviceCall(Unknown Source) at sun.rmi.transport.tcp.TCPTransport.handleMessages(Unknown Source) at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(Unknown Source ... (the rest is truncated) </code></pre> <p>The key I think is that the client (running on my private network) cannot connect to <em>myself</em> (my address is 192.168.x.y where x.y is some other numbers, but the real error message shows my ip address listed there)</p> <p>If I kill the rmi server on the public internet, then I instantly get a "connection refused to host: a.b.c.d") message, so I know that something at the server end is at least working.</p> <p>Any suggestions?</p> <p>EDIT: just to make this a little more clear: 192.168.x.y is the client address, a.b.c.d is the server address. The stacktrace shows the client cannot connect to the client.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload