We are running Tomcat 6 on RHEL 5 and Oracle JDK 1.6_24 and I am having a problem loggin into the jmx services remotely through jconsole.

Here is my setenv.sh :

JAVA_OPTS="-Xms512m -Xmx1152m -XX:MaxPermSize=512m"
CATALINA_OPTS="$CATALINA_OPTS -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=9888"
CATALINA_OPTS="$CATALINA_OPTS -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false"
CATALINA_OPTS="$CATALINA_OPTS -Djava.rmi.server.hostname=192.168.XX.XX"
CATALINA_OPTS="$CATALINA_OPTS -Djava.rmi.server.logCalls=true"

Here is the output from 'ps -elf | grep tomcat' (I also see the 9888 port listening when using netstat) :

0 S root      2930     1  1  85   0 - 500084 184466 20:47 ?       00:00:15 /usr/java/default/bin/java -Djava.util.logging.config.file=/usr/local/tomcat/conf/logging.properties -Xms512m -Xmx1152m -XX:MaxPermSize=512m 
-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -server -Dbuild.compiler.emacs=true -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=9888 -Dcom.sun.management.jmxremote.ssl=false 
-Dcom.sun.management.jmxremote.authenticate=false -Djava.rmi.server.hostname=192.168.XX.XX -Djava.rmi.server.logCalls=true -Djava.endorsed.dirs=/usr/local/tomcat/endorsed
 -classpath /usr/local/tomcat/bin/bootstrap.jar -Dcatalina.base=/usr/local/tomcat -Dcatalina.home=/usr/local/tomcat -Djava.io.tmpdir=/usr/local/tomcat/temp org.apache.catalina.startup.Bootstrap start

Then when trying to connect through jconsole I am running the following command :

jconsole -debug 192.168.XX.XX:9888

It throws the following error:

java.lang.NullPointerException
at javax.management.remote.rmi.RMIConnector.connect(RMIConnector.java:281)
at javax.management.remote.rmi.RMIConnector.connect(RMIConnector.java:228)
at sun.tools.jconsole.ProxyClient.tryConnect(ProxyClient.java:334)
at sun.tools.jconsole.ProxyClient.connect(ProxyClient.java:296)
at sun.tools.jconsole.VMPanel$2.run(VMPanel.java:281)

I have run out of ideas for debugging this and can't seem to find any answers. Any thought or ideas?

As a second problem, shutting down tomcat does not stop the jmx process and i cannot restart tomcat since it is still listening on 9888. Do I have to specify anything to stop the JMX process during shutdown?

Thanks all

  • Dustin Chesterman
3

There are 3 best solutions below

0
On BEST ANSWER

This link will help, you have to specify both the ports. This method is the way to specify both ports. http://gabenell.blogspot.com/2010/04/connecting-to-jmx-on-tomcat-6-through.html

I have got the jconsole to connect without using any authentication but not with authentication. Anybody got this to work?

0
On

I had this kind of error when I had iptables configured on my server. It blocked incoming traffing on these ports. In my setup Tomcat always opened 2 random JMX-ports.

I'll try to find my config files.

k-deux

0
On

I just had the same problem. The fix ended up being to remove the hostname from the 127.0.0.1 line of my /etc/hosts file. This was causing JMX to bind to localhost when it created its data connection.