Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VisualVM unable to sampler memory

I have a tomcat instance with the JMXRemote parameter configured. The local VisualVM is able to get a sampler on CPU, however, not for Memory. The memory button is grayed out with a summary saying: "Memory sampling: Not available. Cannot connect to target application. Make sure the application is running on a supported JDK 6 or JDK 7"

JMXRemote parameter:

-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=9086 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false 

Tomcat JDK version:

JDK1.6.0.30 

VisualVM version:

Version: 1.6.0_30 (Build 1320-110325); platform 110131-9c8b3bfb3a1e System: Windows Server 2008 R2 (6.1) , amd64 64bit Java: 1.6.0_30; Java HotSpot(TM) 64-Bit Server VM (20.5-b03, mixed mode) Vendor: Sun Microsystems Inc., http://java.sun.com/ Environment: Cp1252; en_US (visualvm) Userdir: C:\Users\Administrator\AppData\Roaming\.visualvm\7 Clusters: C:\Program Files\Java\jdk1.6.0_30\lib\visualvm\platform C:\Program Files\Java\jdk1.6.0_30\lib\visualvm\visualvm C:\Program Files\Java\jdk1.6.0_30\lib\visualvm\profiler 

Tomcat version:

Tomcat 6.0.32 

I am running both the VisualVM and Tomcat at win server 2008. Anything i did wrong?

like image 771
Reusable Avatar asked Jan 10 '12 07:01

Reusable


People also ask

Does VisualVM work with Java 11?

Use VisualVM bundled with GraalVMGraalVM contains a fully compliant Java SE 8, Java SE 11, and Java SE 17 JDK distribution based on Oracle JDK and OpenJDK. It features an innovative JIT compiler which may noticeably improve performance of Java applications, compared to the standard Oracle JDK or OpenJDK.

What is VisualVM sampler?

A sampler only takes "snapshots" at distinct point in times. Thing is: when you "profile" everything, then that slows down your JVM significantly; and it creates enormous amounts of data within a few seconds. Think about: the profiler will write down each and any method invocation that takes place!

What is difference between JConsole and VisualVM?

VisualVM takes application monitoring one level deeper than JConsole by allowing the user to analyze thread execution as well as the ability to profile CPU and memory usage of JVM requests, both of which are triggered manually by the user.

Does VisualVM use JMX?

The JVM software exposed via the JMX connection can now be monitored and managed via Java VisualVM.

What does it mean when VisualVM says local application not running?

Description: An error dialog saying that local applications cannot be monitored is shown immediately after VisualVM startup. Locally running Java applications are displayed as <Unknown Application> (pid ###). Resolution: This can happen on Windows systems if the username contains capitalized letters.

What does 'VisualVM has stopped working' dialog message mean?

Description: 'VisualVM has stopped working' dialog is shown during VisualVM startup by the operating system, VisualVM process terminates. Resolution: This problem occurs on Windows systems when the VisualVM process is started in Compatibility mode for Windows 95/98/ME.

What does class sharing is enabled for this JVM mean?

Description: "Class sharing is enabled for this JVM" warning is shown in red box in Profiler tab, profiling CPU or Memory crashes local applications running on JDK 6 Update 6 and earlier. Resolution: There is a known problem with dynamic attach which is used for profiling, it may cause target JVM to crash when class sharing is enabled.


2 Answers

I had the same problem before. You must have downloaded the version from jvisualvm homepage, right? Don't do it! If you use new jdk 1.7, VisualVM is already packaged in your jdk folder. Use this version, you will not have any problem with memory sample.

like image 165
Sifeng Avatar answered Sep 20 '22 20:09

Sifeng


This blog post leads me to believe that the temp directories of JVisualVM and Tomcat need to be the same for memory sampling to work. One of the comments on the post:

the temp directory must be set to the one used by JVisualVM, which can be discovered from the VisualVM system properties tab (java.io.tmpdir). Once I set the CATALINA_TMPDIR directory properly, this worked beautifully.

like image 38
David Minor Avatar answered Sep 22 '22 20:09

David Minor