Search code examples
javatomcatauthenticationjmxmonitor

Can't start Tomcat with -Dcom.sun.management.jmxremote.authenticate=true


I'm trying to monitor Tomcat via JMX. I was testing it locally using jConsole. I'm using the following Java Options without authentication first:

-Dcom.sun.management.jmxremote
-Dcom.sun.management.jmxremote.port=8050
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.authenticate=false

So it works fine but if I try to use authentication it doesn't allow me to start Tomcat:

-Dcom.sun.management.jmxremote
-Dcom.sun.management.jmxremote.port=8050
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.authenticate=true
-Dcom.sun.management.jmxremote.password.file=./conf/jmxremote.password.template
-Dcom.sun.management.jmxremote.access.file=./conf/jmxremote.access

Could you please help me to make it work! What I'm going wrong?


Solution

  • The tomcat monitoring documentation makes mention that you need to have the permissions for the password file set to readable only by the user that tomcat is running as. I can see you're running this in windows, and you've put the jmxremote files in your java installation, which is almost certainly accessible to all accounts on your machine. I'd move them to the conf directory in your tomcat installation, and then check your permissions, and try again.