[英]Running jcmd using JDK-11 on JDK-8 java process not running successfully
I am trying to monitor native memory of tomcat using jcmd but getting following exception: Command: jcmd 14533<pid of tomcat> VM.native_memory summary
我正在尝试使用 jcmd 监控 tomcat 的本机内存,但出现以下异常:命令:
jcmd 14533<pid of tomcat> VM.native_memory summary
I have installed 2 jdk's
jdk-11
AND jdk-8
.我已经安装了 2 个
jdk's
jdk-11
和jdk-8
。
Tomcat is running by jdk-8
and jcmd used jdk-11
then i got following exception: Tomcat 由
jdk-8
运行,jcmd 使用jdk-11
然后我得到以下异常:
com.sun.tools.attach.AttachNotSupportedException: Unable to open socket file /proc/31752/root/tmp/.java_pid31752: target process 31752 doesn't respond within 10500ms or HotSpot VM not loaded
at jdk.attach/sun.tools.attach.VirtualMachineImpl.<init>(VirtualMachineImpl.java:100)
at jdk.attach/sun.tools.attach.AttachProviderImpl.attachVirtualMachine(AttachProviderImpl.java:58)
at jdk.attach/com.sun.tools.attach.VirtualMachine.attach(VirtualMachine.java:207)
at jdk.jcmd/sun.tools.jcmd.JCmd.executeCommandForPid(JCmd.java:114)
at jdk.jcmd/sun.tools.jcmd.JCmd.main(JCmd.java:98)
I attched -XX:+StartAttachListener
with java process but it didn't work.我用 java 进程
-XX:+StartAttachListener
了-XX:+StartAttachListener
但它没有用。
It can be a user permission issue: jmap has to be run with the same user as the java process.这可能是用户权限问题:jmap 必须与 java 进程使用相同的用户运行。 eg if the owner is
usera
and this is running in a docker contained execute jmap as user usera
例如,如果所有者是
usera
并且它在包含的 docker 中运行,则以用户usera
身份执行 jmap
docker exec --user usera -it container_id jmap -dump:format=b,file=/home/usera/memorydump.bin 1
If you are running tomcat as a service on linux check following config in unit file ie tomcat.service如果您在 linux 上将 tomcat 作为服务运行,请检查以下单元文件中的配置,即 tomcat.service
Go through man page for systemd unit file config查看 systemd 单元文件配置的手册页
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.