Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 669
Blankman Avatar asked Dec 01 '22 07:12

Blankman


1 Answers

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.

like image 175
Aamir Yaseen Avatar answered Dec 05 '22 10:12

Aamir Yaseen