Can't connect jconsole to remote server, tomcat failing to start

Blankman picture Blankman · Dec 22, 2011 · Viewed 10.9k times · Source

Trying to connect jconsole to a remote server.

I added this to my catalina.sh:

export JAVA_OPTS="-Dcom.sun.management.jmxremote \
    -Dcom.sun.management.jmxremote.port=9005 \
    -Dcom.sun.management.jmxremote.ssl=false \
    -Dcom.sun.management.jmxremote.authenticate=false \
    -Djava.rmi.server.hostname=xx.xx.xx.xx"

catalina.out shows:

Error: Exception thrown by the agent : java.net.MalformedURLException: Local host name unknown: java.net.UnknownHostException: myhostname: myhostname

Not sure why it repeats my hostname in the error message?

BTW, since I set authentication to false, in the jconsole app, do I leave username/password blank or is that for logging into the server?

Answer

Aamir Yaseen picture Aamir Yaseen · Aug 24, 2012

You have to add the same host name in /etc/hosts file as you have defined in /etc/sysconfig/network file. This is how I solved my problem.