java 远程 jvisualvm 会话不支持 CPU 和分析
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1755819/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
CPU and profiling not supported for remote jvisualvm session
提问by yawn
When monitoring a remote app (using jstatd) I can neither profile nor monitor CPU consumption. Heap monitoring (provided I do not use G1) works. jvisualvm provides the message "Not supported for this JVM." in the CPU graph window.
在监视远程应用程序(使用 jstatd)时,我既不能分析也不能监视 CPU 消耗。堆监控(假设我不使用 G1)有效。jvisualvm 提供消息“此 JVM 不支持”。在 CPU 图形窗口中。
Is there anything missing in my setup? Google showed very few results.
我的设置中是否缺少任何内容?谷歌显示的结果很少。
The local environment (Mac OS X 10.6):
本地环境(Mac OS X 10.6):
java version "1.6.0_15"
Java(TM) SE Runtime Environment (build 1.6.0_15-b03-219)
Java HotSpot(TM) 64-Bit Server VM (build 14.1-b02-90, mixed mode)
The remote environment (Linux version 2.6.16.27-0.9-smp (gcc version 4.1.0 (SUSE Linux))):
远程环境(Linux version 2.6.16.27-0.9-smp (gcc version 4.1.0 (SUSE Linux))):
java version "1.6.0_16" Java(TM) SE
Runtime Environment (build
1.6.0_16-b01) Java HotSpot(TM) 64-Bit Server VM (build 14.2-b01, mixed mode)
Local monitoring works as advertised.
本地监控如宣传的那样工作。
回答by reccles
Remote profiling of code and allocation isn't supported by Visual VM. This sucks, however if you want to enable the CPU graph you can do this by enabling JMX with
Visual VM 不支持代码和分配的远程分析。这很糟糕,但是如果你想启用 CPU 图表,你可以通过启用 JMX 来做到这一点
-Dcom.sun.management.jmxremote=true
-Dcom.sun.management.jmxremote.port=12345
You may need to add some authentication settings too based on your network. The JMX settings will give you the CPU usage, and thread state, as well as doing a remote jstack.
您可能还需要根据您的网络添加一些身份验证设置。JMX 设置将为您提供 CPU 使用率和线程状态,以及执行远程 jstack。
A list of features for the remote version can be found here: Visual VM features
可以在此处找到远程版本的功能列表: Visual VM features
EDITGet the latest version of visual vm 1.2.1 and download the VisaulVM-Sampler. This will read from a JMX connection to show the profiling information.
编辑获取最新版本的visual vm 1.2.1 并下载VisaulVM-Sampler。这将从 JMX 连接读取以显示分析信息。
回答by Kanagavelu Sugumar
Connecting the eclipse java program.
连接eclipse java程序。
Step 1:ensure your Eclipse -> Preferences -> Java -> Installed JREs is pointing to the same jdk where you have started the visualvm.
步骤 1:确保您的 Eclipse -> Preferences -> Java -> Installed JREs 指向您启动 Visualvm 的同一个 jdk。
Step 2:Ensure Right click -> Run configuration has the following
第 2 步:确保右键单击 -> 运行配置具有以下内容
-Dcom.sun.management.jmxremote=true -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.port=16001
-Dcom.sun.management.jmxremote=true -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.port=16001
Step 3: Importantlyfollow the below suggestion.
第 3 步:请务必遵循以下建议。
https://visualvm.java.net/troubleshooting.html#jpswin2
https://visualvm.java.net/troubleshooting.html#jpswin2
Description: An error dialog saying that local applications cannot be monitored is shown immediately after VisualVM startup. Locally running Java applications are displayed as (pid ###).
描述:VisualVM 启动后立即显示一个错误对话框,指出无法监控本地应用程序。本地运行的 Java 应用程序显示为 (pid ###)。
Resolution: This can happen on Windows systems if the username contains capitalized letters. In this case, username is UserName but the jvmstat directory created by JDK is %TMP%\hsperfdata_username. To workaround the problem, exit all Java applications, delete the %TMP%\hsperfdata_username directory and create new %TMP%\hsperfdata_UserName directory.
解决方案:如果用户名包含大写字母,这可能会在 Windows 系统上发生。在这种情况下,用户名是 UserName,但 JDK 创建的 jvmstat 目录是 %TMP%\hsperfdata_username。要解决此问题,请退出所有 Java 应用程序,删除 %TMP%\hsperfdata_username 目录并创建新的 %TMP%\hsperfdata_UserName 目录。
Also try JVMMonitoris decent plugin for eclipse stand alone program monitoring.
也试试JVMMonitor是一个不错的插件,用于 eclipse 独立程序监控。
回答by Rich
Is it because the remote version is (albeit slightly) greater than the local version?
是不是因为远程版本(尽管略有)大于本地版本?

