this article explains how to set up id and password authentication
so if you want to know how to use jconsole and visualVM
Click below link
we have already figured out how to using it in previous article
this article only explains how to set up authentication
Modify setenv.sh
vi /usr/local/tomcat7/bin/setenv.sh
Open stenv.sh in your tomcat home directory through vi editor
#!/bin/sh
JMX_OPTS=" -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.authenticate=true -Dcom.sun.management.jmxremote.password.file=/usr/local/tomcat7/conf/jmxremote.password -Dcom.sun.management.jmxremote.access.file=/usr/local/tomcat7/conf/jmxremote.access -Djava.rmi.server.hostname=52.79.134.63 -Dcom.sun.management.jmxremote.ssl=false"
CATALINA_OPTS=" ${JMX_OPTS} ${CATALINA_OPTS}"
and modify as above
looking closer, the value of '-Dcom.sun.management.jmxremote.authenticate' has been modified from false to true
and below code has been added
-Dcom.sun.management.jmxremote.password.file=/usr/local/tomcat7/conf/jmxremote.password
-Dcom.sun.management.jmxremote.access.file=/usr/local/tomcat7/conf/jmxremote.access
this means settings that directory path of password file to be set and directory path of access file to be set
now we need to create jmxremote.password and jmxremote.access file in /usr/local/tomcat7/conf
Create jmxremote.access and jmxremote.password
Open vi editor like this to create jmxremote.password
vi /usr/local/tomcat7/conf/jmxremote.password
and add below code
admin 1111
user 1111
I created two IDs with the ID admin Password 1111 and ID user and Password 1111
and then open vi editor to create jmxremote.access
vi /usr/local/tomcat7/conf/jmxremote.access
add it like below
admin readwrite
user readonly
now we created completely
Give it execution permit for each file
chmod 750 /usr/local/tomcat7/conf/jmxremote.password
chmod 750 /usr/local/tomcat7/conf/jmxremote.access
ok setting is ended
let's get start
Restart tomcat
[ Connecting jconsole]

Enter the ip and port number and press admin for the username and 1111 for the password
then you will be connected
but if you press user for username and 1111 for password, you will not be able to access it
It seems to be accessible only if you have readwrite permissiion
[ Connecting visualVM ]


Try to access as we accessed in the previous article
you can access this too

finally, we connected jconsole and visualVM with using id and password
Comments
Post a Comment