jvisualvm 没有列出某些 Java 进程 [英] jvisualvm doesn't list certain Java processes

查看:51
本文介绍了jvisualvm 没有列出某些 Java 进程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想获取某个 Java 进程的堆转储(疑似内存泄漏).但是,当我启动 jvisualvm 工具时,我看不到任何正在运行的 Java 进程.

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.

我在谷歌上搜索过这个,并且已经找到几篇文章说你必须使用与启动 jvisualvm 工具相同的 JDK 来运行 Java 进程,以便它能够看到它们.但是,据我所知,情况已经如此.我在本地做所有事情(我可以​​远程访问机器).

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).

需要考虑的几点:

  1. 进程在有防火墙的 Windows 2008 服务器上运行
  2. 进程正在使用重命名版本的 JDK java.exe 可执行文件
  3. 据我所知,这些进程正在使用 1.6.0_18 JDK 运行
  4. 其中一个正在运行的进程启动 RMI 注册表
  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

我正在等待服务器的虚拟化副本,以便我可以处理它(这是一个生产服务器).但与此同时;关于为什么我看不到 jvisualvm(或 jconsole)中的任何进程的任何想法?

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)?

推荐答案

好吧,在我做了一些研究之后,似乎 Peter 的评论是正确的.因为 JVM 进程是由另一个用户(NETWORK SERVICE 帐户,因为它们由 Windows 服务启动)启动的,所以它们没有出现在 jvisualvm 中.

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.

由于我可以访问应用程序配置,因此我找到了以下解决方法,其中包括为目标 JVM 显式启用不安全的 JMX:

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. 添加以下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

通过单击文件 -> 使用 JMX 将远程进程添加到 jvisualvm添加 JMX 连接.您可以使用端口 3333 连接到进程.显然您可以根据需要更改端口.

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.

链接到更详细地解释这一点的文章:http://download.oracle.com/javase/6/docs/technotes/guides/visualvm/jmx_connections.html

  1. 永久保留 JVM 设置可能不是一个好主意,因为它们会允许任何人通过 JMX 连接到 JVM.
  2. 如果需要,您还可以向 JMX JVM 参数添加身份验证.
  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.

这篇关于jvisualvm 没有列出某些 Java 进程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆