Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jvisualvm doesn't list certain Java processes

I want to get a heap dump (suspected memory leak) of a certain Java process. However, when I start the jvisualvm tool, I cannot see any of the running Java processes.

I have Google'd around about this and have already found a couple of articles saying that you have to run the Java processes using the same JDK that you start the jvisualvm tool with in order for it to be able to see them. However, as far as I can see, this is already the case. I'm doing everything locally (I have remote access to the machine).

A couple of things to consider:

  1. The processes are running on a firewalled Windows 2008 server
  2. The processes are running using renamed versions of the JDK java.exe executable
  3. As far as I can see the processes are running using the 1.6.0_18 JDK
  4. One of the running processes starts an RMI registry

I'm waiting on a virtualized copy of the server so I can mess around with it (this is a production server). But in the meanwhile; any ideas as to why I cannot see any of the processes in jvisualvm (or jconsole for that matter)?

like image 694
tmbrggmn Avatar asked Feb 17 '11 15:02

tmbrggmn


People also ask

How can I see all processes in Java?

You can use the ps command to view running Java processes on a system also by piping output to grep . OpenJDK, however, has its very own specific process monitor. The Java Virtual Machine Process Status (jps) tool allows you to scan for each running instance of the Java Virtual Machine (JVM) on your system.

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.

How do I list all Java processes in Windows?

Go to 'Processes' tab. You will see the list of processes running on the system. Bam! Now you will see the entire command line of your java application in the 'command line' column of your java process.

What is difference between JConsole and VisualVM?

JConsole uses only JMX, but VisualVM uses other monitoring technologies like Jvmstat, Attach API and SA in addition to JMX. It can merge data from all those monitoring technologies in one place and the user does not need to think which technology he should use in particular situation.


1 Answers

Well after I did a little research, it would appear that Peter's comment was correct. Because the JVM processes were launched by another user (the NETWORK SERVICE account because they were being started by a Windows service) they didn't show up in jvisualvm.

Workaround

Since I have access to the application configuration, I have found the following workaround, which involves explicitly enabling unsecured JMX for the target JVM:

  1. Add the following JVM parameters:

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

  2. Add the remote process to jvisualvm using JMX by click File -> Add JMX Connection. You can connect to the process using port 3333. Obviously you can change the port if you want.

Link to article explaining this in a little more detail: http://download.oracle.com/javase/6/docs/technotes/guides/visualvm/jmx_connections.html

Notes

  1. It's probably not a good idea to keep the JVM settings permanently, as they would allow anyone to connect to the JVM via JMX.
  2. You can also add authentication to the JMX JVM parameters if you want to.
like image 187
tmbrggmn Avatar answered Sep 28 '22 09:09

tmbrggmn