简体   繁体   English

java jstack工具内存不足或附加权限不足

[英]java jstack tool insufficient memory or insufficient privilege to attach

I am really confused about: In my windows 2008r2, I have a windows service, in fact it's a java progress running as SYSTEM user. 我真的很困惑:在我的Windows 2008r2中,我有一个Windows服务,实际上它是一个以SYSTEM用户身份运行的java进程。 Now, I use Jstack rawly to the the service. 现在,我将Jstack原始用于该服务。 But it occur error : 但它发生错误:

 insufficient memory or insufficient privilege to attach

But if I use Jstack's options -F , it can work finely. 但是,如果我使用Jstack的选项-F ,它可以很好地工作。 I view the jdk's source, It uses a class BugSpotAgent to finish above. 我查看了jdk的源代码,它使用了一个BugSpotAgent类来完成上面的操作。

I want to know the root cause I can't use Jstack rawly, is it the SYSTEM user privilege problem? 我想知道我无法原始使用Jstack的根本原因,是SYSTEM用户权限问题吗? I also have try to use PsExec.exe (a tool) to run my Jstack rawly(That means I will use SYSTEM user to run Jstack ), but it still can't work. 我也尝试使用PsExec.exe (一个工具)来原始运行我的Jstack (这意味着我将使用SYSTEM用户运行Jstack ),但它仍然无法工作。

Can you help me? 你能帮助我吗?

Thanks & Regards! 感谢和问候!

jstack can only latch on to a process started by Same User in Same Session . jstack只能锁定同一用户同一会话中启动的进程。 When a session is not specified the psexec command latches on to console session and throws this error while trying to get thread dump. 如果未指定会话,则psexec命令将锁定到控制台会话,并在尝试获取线程转储时抛出此错误。

The solution is to ensure the user and session used with psexec is the same as one used for target java process. 解决方案是确保用于psexec的用户和会话与用于目标java进程的用户和会话相同。

if it has been started by a regular user, a. 如果它是由普通用户启动的,a。 use the same user credentials to login without -s or -h flag b. 使用相同的用户凭据登录而不使用-s或-h标志b。 find the session ID in which the process was started. 找到启动进程的会话ID。 (You can find it using Task Manager and going to the Tab Users). (您可以使用任务管理器找到它并转到选项卡用户)。 Use this session id with the flag -i 将此会话ID与标志-i一起使用

psexec \\\\server-name -u username -p password -i session-id command

eg 例如

psexec \\\\192.168.1.1 -u john -p pass123 -i 1 jstack.exe 4242

Note: If the java process has been started by a SYSTEM user use the flag -s 注意:如果SYSTEM进程已经启动了java进程,请使用标志-s

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM