java.rmi.ConnectException Connection refused to host: 127.0.0.1
The Java Remote Method Invocation (RMI) methods expect that the hostname of the server will resolve to the external IP address system. If the system is configured in a non-standard way, the name can resolve to the localhost (or 127.0.0.1) address. The RMI service is attached to an external IP address and not the internal or loopback address.
Fix: Configure IP and hostname resolution on the server. (The customer may not be able or authorized to do this.)
Workaround 1 – Add the following to the Java start line:
The string sequence $(hostname) can only be used in Unix system shell scripts. Try for the external host name if you use this string. On other systems you may need to use the permanent host address. Using a fixed value of any kind must be done thoughtfully as any change to the name or IP address of the server will also need to be made to the eFORMz startup.
Workaround 2 – Use the Web Server options. All the RMI connections would then be made to localhost (127.0.0.1) instead of the outside address.
Note: If the server is behind a firewall that uses Network-Address-Translation (NAT), either of the two workarounds will permit access to the services.
- Communication Exception
Error connecting to the Director. Failed to retrieve RMIServer stub: Javax.naming.CommunicationException (Root exception is Java.rmi.ConnectIOException: non-JRMP server at remote endpoint)
Java.rmi.ConnectIOException: non-JRMP server at remote endpoint means that a connection was made to something that did not communicate like the Director. Troubleshooting could include the following:
- Verify that the Director started. Use the
ps -efcommand to confirm a copy of Java is running Director.
- Check the logs. Did the Director start or is there an exception?
- Check the open ports. Use the
netstatcommand with options to show the open ports and what application opened them.
- Service Unavailable Exception
Error connecting to the Director. Failed to retrieve RMIServer stub: Javax.naming.ServiceUnavailableException (Root exception is Java.rmi.ConnectException: Connection refused to host: localhost: nested exception)
This problem was seen on a Windows system that was recently updated. The following steps resolved the error:
- Remove system from the domain and rejoin.
- Verify that the eFORMz service runs as Network Service.
Keywords: Failed to Retrieve RMI Server Stub, RMI