You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomee.apache.org by Andy Gumbrecht <ag...@tomitribe.com> on 2014/08/27 17:49:53 UTC

Getting VisualGC plugin to run with VisualVM and TomEE

To quickly add some additional info to my last blog here: 
http://www.tomitribe.com/blog/2014/07/monitoring-an-apache-tomee-service-on-windows-with-visualvm/

Getting VisualGC to run with VisualVM and TomEE
----------------------------------------------------------------------

VisualGC is a VisualVM plugin - So unless you actually require it, just 
ignore this post.

To cut a long story short - VisualGC will not work on a Windows Service, 
so don't lose too much time trying.

When I refer to the [JDK] I mean [The full path to the same or better 
JDK version as TomEE uses]

VisualGC requires that the JDK tool 'jstatd' is running prior to 
starting VisualVM, to do this we need a policy file. Here are the steps:

Create a file called 'tools.policy' somewhere you have unrestricted 
access to, then add the following to it and save it (Obviously changing 
the path to your own JDK):

grant codebase "file:[JDK]/lib/tools.jar" {
    permission java.security.AllPermission;
};

Run jstatd, specifying the path to the policy file and the RMI host 
(create a batch file to make this easy):

"[JDK]\bin\jstatd.exe" -J-Djava.security.policy="[Full path 
to]/tools.policy" -J-Djava.rmi.server.hostname=127.0.0.1

Now stop any TomEE service that may be running.

Add the following line to the beginning of the '[TomEE]/bin/startup.bat' 
file

set "CATALINA_OPTS=-Dcom.sun.management.jmxremote=true 
-Dcom.sun.management.jmxremote.port=9090 
-Dcom.sun.management.jmxremote.ssl=false 
-Dcom.sun.management.jmxremote.authenticate=false 
-Djava.rmi.server.hostname=127.0.0.1"

Run the '[TomEE]/bin/startup.bat' file (as an administrator if possible)

Now after you start VisualVM you should see two 'Tomcat' listings, 
choosing the non-JMX one is preferable.

Andy.

PS. I'll create a blog for this later.

-- 
   Andy Gumbrecht
   https://twitter.com/AndyGeeDe
   http://www.tomitribe.com