VisualVM is a tool that provides a visual interface for viewing detailed information about Java applications while they are running on a Java Virtual Machine (JVM), and for troubleshooting and profiling these applications.
Firs of all you need to configure JMX. For tomcat you need to perform this:
Firs of all you need to configure JMX. For tomcat you need to perform this:
- In folder %CATALINA_HOME%/conf need to create remote.users with content:
USER_1 PASSWORD_2 USER_2 PASSWORD_2
- In folder %CATALINA_HOME%/conf need to create remote.acl with content:
USER_1 PERMISSION_1 USER_2 PERMISSION_2
where permissions:readonly,
readwrite
- chmod 400 remote.users
- chmod 400 remote.acl
- chown tomcat:tomcat remote.users
- chown tomcat:tomcat remote.acl
- In tomcat %CATALINA_HOME%/bin/catalina.sh need to add:
CATALINA_OPTS="$CATALINA_OPTS -Dcom.sun.management.jmxremote.password.file=/opt/tomcat/conf/remote.users -Dcom.sun.management.jmxremote.access.file=/opt/tomcat/conf/remote.acl -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=7777 -Dcom.sun.management.jmxremote.ssl=false -Djava.rmi.server.hostname=1.1.1.1"
where hostname - is tomcat server ip, and port - any not used port - Restart Tomcat
-
Visual VM comes with JDK from 6u7, run it on your local machine
$JAVA_HOME/bin/jvisualvm
Click
File->Add JMX connectionuse user, password, host and port
Will appear new perspective whith your server connection
Nice writeup - thanks for that!
ReplyDelete