Вопрос

I have a Java application, and I'd like to monitor it using Java VisualVM (jvisualvm).

However, in the VisualVM window very little data can be seen. Also, I can't take a heap dump.

Here is a screenshot of what it looks like, with another test app I wrote:

screenshot

I can monitor memory usage, classes loaded and threads. Heap dumps, performing GC as well as sampling is disabled.

I have tried adding -Dcom.sun.management.jxmremote to VM arguments, as described here. This is showing up in the Installation Details window. However, it does not appear in the Java process arguments. (should it?)

screenshots

I also tried to click the button in my test app until an OutOfMemoryError occurred. No heap dump; that is not weird as Heap Dump on OOME is disabled.

What could I do to solve this?

Это было полезно?

Решение 2

It seems there was a problem with different Java versions.

A long story short: If JDK is outdated re-install it, and delete Java executables from C:\Windows\System32 and C:\Windows\SysWOW64.

Firstly, I want to tell you that I have multiple versions of Java on my computer. My JDK is 32-bit because of some drivers not running with 64-bit Java. Also, I have both 32-bit and 64-bit JRE installed, the latter for better performance for Java games.

My JDK was version 7, update 40. The VisualVM was so also that version. However, my JRE with auto updates was version 7, update 45.

java -version told me it was version 45 (which it was), so I didn't think the problem was there.

Then, I checked the versions via Control Panel. I now knew my JDK was outdated, so I uninstalled it and redownloaded it.

Uninstalling removed Java from the system path, so jvisualvm wouldn't run. I added it to the path. Now both the app and VisualVM ran normally, but still the problem persisted.

The final problem was that the system was using the java.exe from C:\Windows\System32 instead of the JDK one. By the date it seemed to be the latest one, but maybe it was that the JRE was installed in a different location that the VisualVM (= the JDK).

Finally, I just deleted the Java executables in both C:\Windows\System32 and C:\Windows\SysWOW64.

Другие советы

I had this problem because I was running JVisualVM from a different JRE/JDK installation than the target process. It seems that the two must be coming from the same place or it grays out the Heap Dump button.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top