尝试通过 JMX 连接时,本地 java 进程呈灰色

发布于 2024-11-06 08:02:47 字数 209 浏览 6 评论 0原文

我在 Windows XP Professional 机器上运行许多 Java 进程。当我尝试通过本地 JConsole 连接到这些进程时,进程显示为灰色。

但是,我可以在另一台计算机上运行相同的进程,并通过该计算机上的本地 JConsole 进行连接。

两台机器都运行 java 1.6 版本的进程和 jconsole。

你知道为什么这些进程是灰色的吗?

I'm running a number of java processes on a windows XP professional machine. When i attempt to connect to these processes via a local JConsole the processes are grayed out.

However i can run the same processes on another machine and connect via a local JConsole on that machine.

Both machines are running java 1.6 version for the processes and jconsole.

Any ideas why these processes are grayed out?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(10

水晶透心 2024-11-13 08:02:47

我现在正在解决这个问题,我找到了一个解决方法:

您可以将本地用户的临时目录更改为他们绝对可以访问的目录(例如 D:\temp)。确保对您尝试监视的进程和 jconsole 进程执行此操作。

显然可能导致问题的另一件事是用户名中包含大写字母。该目录将始终使用所有小写字母创建,但只需将其重命名为任务管理器中显示的方式即可使所有问题消失: http://planeofthought.com/wp/?p=75

I'm fighting with this issue right now and I found out a work around:

You can change the local user's temp dir to something that they can definitely access (e.g. D:\temp). Make sure to do this for the process you're trying to monitor and the jconsole process.

Another thing that can apparently cause issues are usernames with uppercase letters in them. The directory will always be created with all lowercase letters, but simply renaming it to exactly how it's being shown in the Task Manager made all the issues go away: http://planeofthought.com/wp/?p=75

Bonjour°[大白 2024-11-13 08:02:47

如果进程以不同的用户身份运行(例如,如果您将它们作为服务启动),那么您将无法连接到它们。另外,如果它们在较旧的 jvm 下运行,您很可能也无法与它们交谈。

在某些情况下,本地 jmx 通信机制使用本地文件系统,如果权限定义不正确,可能会出现问题。您是否可能在网络文件系统(nfs、samba)上运行这些进程?

if the processes are running as a different user (e.g. if you start them as services), then you won't be able to connect to them. also, if they are running under an older jvm, you most likely won't be able to talk to them either.

in some cases, the local jmx communication mechanism uses the local filesystem and may have issues if permissions are not defined correctly. are you possibly running any of these processes on networked filesystems (nfs, samba)?

春夜浅 2024-11-13 08:02:47

假设您用于启动任务管理器中显示的 java 应用程序的 Windows 用户名是 YOUR_USER_NAME。
请检查临时文件夹中名称类似于 hsperfdata_XXXXX(XXXXX 应该是您的用户名)的文件夹,并确保 YOUR_USER_NAME 和 XXXXX 完全相同(注意大小写)。

Say your windows user name you use to start your java application seen in task manager is YOUR_USER_NAME.
Please check a folder whose name looks like hsperfdata_XXXXX (XXXXX should be your user name) in your temp folder and make sure YOUR_USER_NAME and XXXXX are exactly the same (be careful about the upper and lower case).

护你周全 2024-11-13 08:02:47

来自 http://download.oracle.com/javase /6/docs/technotes/guides/management/jconsole.html

禁用管理代理后不可附加的应用程序。其中包括在 J2SE 1.4.2 平台上启动的应用程序或在没有 -Dcom.sun.management.jmxremotecom.sun.management.jmxremote.port 的 J2SE 5.0 平台上启动的应用程序代码>选项。 这些应用程序在表格中显示为灰色,并且 JConsole 无法连接到它们。在图 3-1 所示的示例连接对话框中,Anagrams 应用程序是使用 J2SE 5.0 平台 VM 启动的,没有任何管理属性来启用 JMX 代理,因此显示为灰色且无法选择。

图 3 -1 创建与本地进程的连接
(来源:oracle.com< /a>)

不管文档中写了什么,您的进程很可能在不同的用户下运行。您可以以管理员身份运行jconsole然后尝试。

From http://download.oracle.com/javase/6/docs/technotes/guides/management/jconsole.html:

Applications that are not attachable, with the management agent disabled. These include applications started on a J2SE 1.4.2 platform or started on a J2SE 5.0 platform without the -Dcom.sun.management.jmxremote or com.sun.management.jmxremote.port options. These applications appear grayed-out in the table and JConsole cannot connect to them. In the example connection dialog shown in Figure 3-1, the Anagrams application was started with a J2SE 5.0 platform VM without any of the management properties to enable the JMX agent, and consequently shows up in gray and cannot be selected.

Figure 3-1 Creating a Connection to a Local Process
(source: oracle.com)

Despite what's being written in the documentation, most likely your process is running under a different user. You can run jconsole as an administrator and try then.

沫雨熙 2024-11-13 08:02:47

这对我有用。我更改了 %TEMP%%TMP% 环境变量以指向我在 %HOME% 位置创建的文件夹(例如 %HOME% >C:\Users\[YOUR_NAME]\Temp)。一旦我这样做了,所有的问题都消失了。

Here is what worked for me. I changed my %TEMP% and %TMP% environment variables to point to a folder I created in my %HOME% location (like C:\Users\[YOUR_NAME]\Temp). Once I did this, all problems vanished.

美人如玉 2024-11-13 08:02:47

我遇到了前面描述的问题,但建议采用更简单的解决方案:只需关闭所有使用 Java 的程序(“IntelliJ IDEA”、“SoapUI”等 - 解锁临时文件夹),然后删除 %TMP%\ hsperfdata_<用户名> 文件夹。然后,在打开任何 Java 程序后,将重新创建此文件夹,但这次名称正确(很可能是 %TMP%\hsperfdata_)。之后,可以通过“JConsole”或“VisualVM”监视本地 Java 进程(现在运行时不会出现启动错误,链接为 VisualVM:故障排除指南)。

I had the problem as described earlier, but was advised a simpler solution: just close all programs using Java ("IntelliJ IDEA", "SoapUI", etc. - to unlock the temporary folder) and then delete %TMP%\hsperfdata_<user.name> folder. Then, after opening any Java program, this folder will be recreated but this time with correct name (most likely %TMP%\hsperfdata_<User.Name>). And after that, local Java processes can be monitored through "JConsole" or "VisualVM" (now runs without starting error with a link to VisualVM: Troubleshooting Guide) again.

帅气称霸 2024-11-13 08:02:47

您可以直接转到 CMD,然后输入 jconsole.exe (PID),而不是执行此步骤。

请记住转到 jconsole 所在的路径,然后运行可执行文件。

instead of this steps you can just goto the CMD and then type in jconsole.exe (PID)

Remember to go to the path where jconsole is present and then run the executable file.

季末如歌 2024-11-13 08:02:47

更改在 C:\Users\pmimgg0\AppData\Local\Temp\hsperfdata_pmimgg0 中找到的 hsperfdata 文件夹的名称,以匹配任务管理器上找到的用户名。一旦我将 hsperfdata_pmimgg0 更改为 hsperfdata_PMIMGG0,我的本地进程就不再在 jconsole 上显示为灰色。

输入图片此处描述

Change the name of the hsperfdata folder which for me was found at C:\Users\pmimgg0\AppData\Local\Temp\hsperfdata_pmimgg0 to match the User name found on task manager. Once I changed hsperfdata_pmimgg0 to hsperfdata_PMIMGG0 my local process was no longer greyed out on jconsole.

enter image description here

轻许诺言 2024-11-13 08:02:47

将环境变量中的 TEMP 路径更改为 D:\temp 之类的路径,因为这可能是权限问题。为我解决了这个问题

Change your TEMP paths in Environment Variables to something like D:\temp as it could be a permission issue. Fixed this issue for me

塔塔猫 2024-11-13 08:02:47

最好的方法是像远程进程一样运行本地进程

在运行时参数中添加这些条件 -

-Dcom.sun.management.jmxremote=true
-Dcom.sun.management.jmxremote.port=6001
-Dcom.sun.management.jmxremote.authenticate=false
-Dcom.sun.management.jmxremote.ssl=false
-Djava.rmi.server.hostname=localhost
-Dcom.sun.management.jmxremote.rmi.port=6001

然后选择远程进程并指向 localhost:6001,如图所示

JConsole 新连接

点击连接,Jconsole 连接成功。

对我来说,这是固定的,因为我有一些管理限制。

The best way is to run local process like a remote process.

Add these conditions in runtime arguments -

-Dcom.sun.management.jmxremote=true
-Dcom.sun.management.jmxremote.port=6001
-Dcom.sun.management.jmxremote.authenticate=false
-Dcom.sun.management.jmxremote.ssl=false
-Djava.rmi.server.hostname=localhost
-Dcom.sun.management.jmxremote.rmi.port=6001

Then select Remote Process and point to localhost:6001 as shown

JConsole New Connection

Click Connect and Jconsole is connected successfully.

For me this fixed as I had some admin constraints.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文