Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I' m trying to set up remote JMX monitoring on a Java process. These are the options I'm giving the JVM to start it:

JAVA_OPTS="-server -Xms1G -Xmx1G -XX:MaxPermSize=512m "
JMX_OPTS="$JMX_OPTS -Dfoo.jmx=true -Dfoo.jmx.detailed=true"
LOG_OPTS="-Dfoo.logging.type=log4j -DLOGDIR=${SERVERDIR}/logs"
ASD_OPTS="-Dfoo.conf.file=file:${PROPFILE} -cp ${CLASSPATH} foo"
/usr/bin/nohup ${JAVA_EXE} $JAVA_OPTS $JMX_OPTS $LOG_OPTS $ASD_OPTS 1>${SERVERDIR}/service.log 2>&1 &

I'm able to connect using Jconsole locally, but when I connect from a remote host, I get following error (cut for brevity's sake)

Java.rmi.ConnectException: Connection refused to host:; nested exception is: Connection refused: <snip>

So despite the explicit declaration saying to bind to (, JMX is still binding to the remote system's loopback interface.

The only workaround I've found is to modify my /etc/hosts to set the system's FQDN like so:       localhost localhost.localdomain

Based on the fact that every Linux system I've ever seen has "" pointing at, I can only imagine weird problems with changing this.

How can I get remote JMX monitoring working without this hack?

The system is CentOS 6, Java 1.6.0_35, firewall disabled for testing.

share|improve this question
Are you sure the property isn't java.rmi.server.hostname, not – Mark Wagner May 15 '13 at 22:51
You probably should not have the FQDN defined as in /etc/hosts. This can cause all sorts of things to go haywire. – Michael Hampton May 15 '13 at 22:57
Mark is correct. I had typo'd java.rmi.server.hostname. Thank you! – grog_7 May 16 '13 at 15:55

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.