if you want to enabled jmxremote.authenticate then use this.
in setenv.sh
-Dcom.sun.management.jmxremote.port=7091 \
-Dcom.sun.management.jmxremote.ssl=false \
-Dcom.sun.management.jmxremote.authenticate=true \
-Djava.rmi.server.hostname=127.0.0.1 \
-Dcom.sun.management.jmxremote.password.file=/usr/tomcat/conf/jmxremote.password \
-Dcom.sun.management.jmxremote.access.file=/usr/tomcat/conf/jmxremote.access"
vi jmxremote.access file
monitor readonly
admin readwrite \
create javax.management.monitor.*,javax.management.timer.* \
unregister
vi jmxremote.password file
monitor pass1
admin pass2
change permission
sudo chown tomcat7:tomcat7 /usr/tomcat/conf/jmxremote.*
sudo chmod 0600 /usr/tomcat/conf/jmxremote.*
Controlling the Ports
we need to add jmx listener
/usr/tomcat/conf/server.xml file like this:
<Listener className="org.apache.catalina.mbeans.JmxRemoteLifecycleListener"
rmiRegistryPortPlatform="7091" rmiServerPortPlatform="7091" />
add jmx jar file inside tomcat lib:/usr/tomcat/lib/.
The jar we are looking for is called catalina-jmx-remote.jar.
Restart tomcat then try to connect using jconsole or jvisualvm
reference :
1. https://blog.markshead.com/1129/connecting-visual-vm-to-tomcat-7/
2.https://geekflare.com/enable-jmx-tomcat-to-monitor-administer/#:~:text=JMX%20(Java%20Management%20Extension)%20is,Classes%2C%20and%20configure%20various%20MBeans.