When attempting to lookup an EJBHome on JBoss 3.0.3 from a remote client, we were getting the following exception on the client:
javax.naming.CommunicationException. Root exception is
java.rmi.ConnectException: Connection refused to host: 127.0.0.1; nested exception is:
java.net.ConnectException: Connection refused: connect
After some digging, we found that the problem is that the correct host name is not being bound by the RMI Server in JBoss. There appear to be two solutions:
1. set the "java.rmi.server.hostname" environment variable to the hosts fully qualified name or IP address in the run.sh / run.bat startup script.
2. set the name of the localhost in the /etc/hosts file to be the fully qualified name or IP address
An example of solution 1:
( in run.sh )
JAVA_OPTS="$JAVA_OPTS -Dprogram.name=$PROGNAME -Djava.rmi.server.hostname=$FULL_HOST_NAME"