AndreFonseca
AndreFonseca

Reputation: 35

VisualVM - Memory Sampling in Windows 8 - Tomcat 7 as Service

I'm using the VisualVm to do some profiling in a web application but the memory button is disabled in the Sampler tab.

I am using Windows 8, Tomcat 7, VisualVM 1.7.0_09 (build 120605), and JDK 1.6.0_11

I've tried some (run tomcat service as current user, set the temp of the catalina to the sames as visualvm ) workarounds but none seem to work, i read somewhere that after vista this seems not to work.

Can I do a memory profiling with this scenario?

Upvotes: 1

Views: 866

Answers (1)

Celebes
Celebes

Reputation: 1431

What helped me in the exact same situation was using the same version of Java JDK and Java JRE on my local Tomcat. It turned out that my Tomcat was using JDK 1.6.0_45 and JRE 1.6.0_20.

To check JRE version on your system open console and write "java -version"
To check JDK version on your system open console and write "javac -version"

Create two system variables pointing to your JDK and JRE locations, for example:
JAVA_HOME variable with path "C:\Program Files\Java\jdk1.6.0_45"
JRE_HOME variable with path "C:\Program Files\Java\jre6"

Edit "Path" system variable and add this string to the end of its value: "%JAVA_HOME%/bin;%JRE_HOME%/bin"

Relog on your system, your system variables will now work.

Tomcat will use those system variables automatically as stated in catalina.bat's comment section:

JAVA_HOME       Must point at your Java Development Kit installation.
                Required to run the with the "debug" argument.

JRE_HOME        Must point at your Java Runtime installation.
                Defaults to JAVA_HOME if empty. If JRE_HOME and JAVA_HOME
                are both set, JRE_HOME is used.

Go to your folder tomcat\bin and run "catalina.bat" file to check if you JRE_HOME variable is set correctly.

TIP: If you've got a "setenv.bat" file in Tomcat's bin folder, make sure there is nothing like "set "JRE_HOME=..." " in it, because it will overwrite your system variable and you don't want that.

After all has been set go to VisualVM -> double-click your Tomcat instance -> overview -> System Proprties -> copy it to some text editor and search for "jdk" and "jre" words. Versions next to them should now match.

Memory Profiling should be available now.

Upvotes: 1

Related Questions