Mac 使用 jinfo 出现:Can't attach to the process. Could be caused by an incorrect pid or lack of privileg

Mac 系统版本:

Mac 使用 jinfo 出现:Can't attach to the process. Could be caused by an incorrect pid or lack of privileg_第1张图片

Java 版本:

Dongguabai:~ dongguabai$ java -version
java version "1.8.0_201"
Java(TM) SE Runtime Environment (build 1.8.0_201-b09)
Java HotSpot(TM) 64-Bit Server VM (build 25.201-b09, mixed mode)

异常信息:

Dongguabai:~ dongguabai$ jps
994 
1027 Launcher
1014 RemoteMavenServer
1037 Jps
Dongguabai:~ dongguabai$ 
Dongguabai:~ dongguabai$ 
Dongguabai:~ dongguabai$ 
Dongguabai:~ dongguabai$ 
Dongguabai:~ dongguabai$ jinfo -flags 1014
Attaching to process ID 1014, please wait...
Error attaching to process: sun.jvm.hotspot.debugger.DebuggerException: Can't attach symbolicator to the process
sun.jvm.hotspot.debugger.DebuggerException: sun.jvm.hotspot.debugger.DebuggerException: Can't attach symbolicator to the process
	at sun.jvm.hotspot.debugger.bsd.BsdDebuggerLocal$BsdDebuggerLocalWorkerThread.execute(BsdDebuggerLocal.java:169)
	at sun.jvm.hotspot.debugger.bsd.BsdDebuggerLocal.attach(BsdDebuggerLocal.java:287)
	at sun.jvm.hotspot.HotSpotAgent.attachDebugger(HotSpotAgent.java:671)
	at sun.jvm.hotspot.HotSpotAgent.setupDebuggerDarwin(HotSpotAgent.java:659)
	at sun.jvm.hotspot.HotSpotAgent.setupDebugger(HotSpotAgent.java:341)
	at sun.jvm.hotspot.HotSpotAgent.go(HotSpotAgent.java:304)
	at sun.jvm.hotspot.HotSpotAgent.attach(HotSpotAgent.java:140)
	at sun.jvm.hotspot.tools.Tool.start(Tool.java:185)
	at sun.jvm.hotspot.tools.Tool.execute(Tool.java:118)
	at sun.jvm.hotspot.tools.JInfo.main(JInfo.java:138)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at sun.tools.jinfo.JInfo.runTool(JInfo.java:108)
	at sun.tools.jinfo.JInfo.main(JInfo.java:76)
Caused by: sun.jvm.hotspot.debugger.DebuggerException: Can't attach symbolicator to the process
	at sun.jvm.hotspot.debugger.bsd.BsdDebuggerLocal.attach0(Native Method)
	at sun.jvm.hotspot.debugger.bsd.BsdDebuggerLocal.access$100(BsdDebuggerLocal.java:65)
	at sun.jvm.hotspot.debugger.bsd.BsdDebuggerLocal$1AttachTask.doit(BsdDebuggerLocal.java:278)
	at sun.jvm.hotspot.debugger.bsd.BsdDebuggerLocal$BsdDebuggerLocalWorkerThread.run(BsdDebuggerLocal.java:144)

官方说明:

https://bugs.java.com/bugdatabase/view_bug.do?bug_id=8160376

https://bugs.java.com/bugdatabase/view_bug.do?bug_id=8161164

解决:

有的地方说是系统的安全权限有问题,有的地方说是 JDK 的 bug。看上诉官方说明好像是说可以使用 JDK 9。但是官方又建议使用 JDK 10:

https://www.oracle.com/technetwork/java/javase/downloads/jdk9-downloads-3848520.html

最后更换成为 JDK 11。问题解决。

你可能感兴趣的:(exception,jvm,&,jdk,mac,os)