java jstack工具内存不足或附加权限不足 [英] java jstack tool insufficient memory or insufficient privilege to attach

查看:1966
本文介绍了java jstack工具内存不足或附加权限不足的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我真的很困惑:
在我的Windows 2008r2中,我有一个Windows服务,实际上它是一个以 SYSTEM 用户身份运行的java进程。现在,我将 Jstack 粗略地用于该服务。但它出现错误:

 内存不足或附加


但如果我使用Jstack的选项 -F ,它可以很好地工作。我查看了jdk的源代码,它使用了一个 BugSpotAgent 类来完成上面的工作。



我想知道我不能使用的根本原因 Jstack 原来,是 SYSTEM 用户权限问题?我也尝试使用 PsExec.exe (一种工具)来粗略地运行我的 Jstack (这意味着我将使用 SYSTEM 用户来运行 Jstack ),但它仍然无法正常工作。



你能帮助我吗?



<谢谢&问候!

解决方案

jstack 只能锁定由相同用户<启动的进程/ strong>在同一会话中。如果未指定会话, psexec 命令将锁定到控制台会话,并在尝试获取线程转储时抛出此错误。



解决方案是为了确保用于 psexec 的用户和会话与用于目标java的用户和会话相同过程。



如果它是由普通用户启动的,
a。使用相同的用户凭据登录而不使用-s或-h标志
b。找到启动进程的会话ID。 (您可以使用任务管理器找到它并转到选项卡用户)。将此会话ID与标志-i



psexec \\ server-name -u username -p password -i session-id命令一起使用



例如



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



注意:如果java进程已经启动SYSTEM用户使用标志-s


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. Now, I use Jstack rawly to the the service. But it occur error :

 insufficient memory or insufficient privilege to attach

But if I use Jstack's options -F , it can work finely. I view the jdk's source, It uses a class BugSpotAgent to finish above.

I want to know the root cause I can't use Jstack rawly, is it the SYSTEM user privilege problem? 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.

Can you help me?

Thanks & Regards!

解决方案

jstack can only latch on to a process started by Same User in Same Session. When a session is not specified the psexec command latches on to console session and throws this error while trying to get thread dump.

The solution is to ensure the user and session used with psexec is the same as one used for target java process.

if it has been started by a regular user, a. use the same user credentials to login without -s or -h flag b. find the session ID in which the process was started. (You can find it using Task Manager and going to the Tab Users). Use this session id with the flag -i

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

e.g.

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

这篇关于java jstack工具内存不足或附加权限不足的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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