Skip to content

Instantly share code, notes, and snippets.

@theothermattm
Last active August 29, 2015 14:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save theothermattm/77bd9e9685911612af58 to your computer and use it in GitHub Desktop.
Save theothermattm/77bd9e9685911612af58 to your computer and use it in GitHub Desktop.
Get Java 7 visualvm working on remote Tomcat server
# Tomcat setup
# add the following to the JVM_OPTS for the given tomcat instance
VISUAL_VM_SETTINGS="-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.local.only=false -Dcom.sun.management.jmxremote.port=8086 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Xverify:none"
# note that on os x, some StackOverflow posts have discussed the need for an additiona "-Xshare:off" setting.
# To run jstatd
# create a file called jstatd.all.policy
# see http://docs.oracle.com/javase/7/docs/technotes/tools/share/jstatd.html
# with the following in it:
echo "grant codebase \"file:\${java.home}/../lib/tools.jar\" { \
permission java.security.AllPermission; \
};" > /tmp/jstatd.all.policy
# start jstatd from java home
${JAVA_HOME}/jstatd -J-Djava.security.policy=/tmp/jstatd.all.policy
# you can then connect on port 8086, though visualvm should pick it right up
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment