尝试通过 JMX 连接时,本地 java 进程呈灰色
我在 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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(10)
我现在正在解决这个问题,我找到了一个解决方法:
您可以将本地用户的临时目录更改为他们绝对可以访问的目录(例如 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
如果进程以不同的用户身份运行(例如,如果您将它们作为服务启动),那么您将无法连接到它们。另外,如果它们在较旧的 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)?
假设您用于启动任务管理器中显示的 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).
来自 http://download.oracle.com/javase /6/docs/technotes/guides/management/jconsole.html:
(来源:oracle.com< /a>)
不管文档中写了什么,您的进程很可能在不同的用户下运行。您可以以管理员身份运行
jconsole
然后尝试。From http://download.oracle.com/javase/6/docs/technotes/guides/management/jconsole.html:
(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.这对我有用。我更改了
%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 (likeC:\Users\[YOUR_NAME]\Temp
). Once I did this, all problems vanished.我遇到了前面描述的问题,但建议采用更简单的解决方案:只需关闭所有使用 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.您可以直接转到 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.
更改在 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.
将环境变量中的 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
最好的方法是像远程进程一样运行本地进程。
在运行时参数中添加这些条件 -
然后选择远程进程并指向 localhost:6001,如图所示
点击连接,Jconsole 连接成功。
对我来说,这是固定的,因为我有一些管理限制。
The best way is to run local process like a remote process.
Add these conditions in runtime arguments -
Then select Remote Process and point to localhost:6001 as shown
Click Connect and Jconsole is connected successfully.
For me this fixed as I had some admin constraints.