JVM remote monitoring

5,330

Finally I make it work. I added the setting in JAVA_OPTS variable in tomcat startup script as below:

JAVA_OPTS="-Djava.awt.headless=true -Xms256m -Xmx1024m -XX:PermSize=512m -server -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=6969 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false"
Share:
5,330
Ramesh Kumar
Author by

Ramesh Kumar

I am Linux freak.. :)

Updated on September 17, 2022

Comments

  • Ramesh Kumar
    Ramesh Kumar over 1 year

    I was trying to configure JVM for remote monitoring but getting the below error on server

    The configuration has not been set for this resource due to : Invalid configuration: Error contacting resource: Can't connect to MBeanServer [{jmx.username=system, jmx.url=service:jmx:rmi:///jndi/rmi://localhost:6969/jmxrmi}]: java.io.IOException: Failed to retrieve RMIServer stub: javax.naming.ServiceUnavailableException [Root exception is java.rmi.ConnectException: Connection refused to host: localhost; nested exception is: java.net.ConnectException: Connection refused]
    

    I want to monitor tomcat server, according to the doc I have add the remote monitoring Mbean Server connection string in /tomcat/bin/catalina.sh file

    [ $1 != "stop" ] && JAVA_OPTS="-Dcom.sun.management.jmxremote \ 
    -Dcom.sun.management.jmxremote.port=6969 \ 
    -Dcom.sun.management.jmxremote.ssl=false \ 
    -Dcom.sun.management.jmxremote.authenticate=false $JAVA_OPTS" 
    export JAVA_OPTS
    

    I have restarted the tomcat service after that. But not able to see port 6969 listening on the server. After restarting the tomcat i have checked it via "netstat -an | grep 696" I think this is the problem. Port 6969 is not used on this machine.

  • Ramesh Kumar
    Ramesh Kumar over 13 years
    I am trying on the same machine
  • Carlos Garcia
    Carlos Garcia over 13 years
    Dont see the difference between this and the original, all are in catalina.sh how starts the server. ¿right? the only diff is that java.awt.headless... is that was prevented JMX to run? I dont use it and it works for me... ¿Maybe that $1 = Stop was the problem?