1. jconsole连接不上本地JVM进程
- 环境
OS:macOS Mojave 10.14.5
JDK版本:HotSpot 1.8.0_191
IDE版本:Intellij IDEA 2018.3.5
- 问题如图所示
- 解决方法
JVM增加如下启动参数
-Djava.rmi.server.hostname=localhost -Dcom.sun.management.jmxremote
参考链接:https://stackoverflow.com/questions/18294130/jconsole-cannot-connect
PS: 该问题网上不少抄来抄去的,也不知道最后解决了没有。反正我试了的基本都没能解决。
本解决方案经本人验证是可以的,其他环境如有不同,不确定是否可行。
如有问题,可以尝试下再加一个参数 -Dcom.sun.management.jmxremote.local.only=false,或自行搜索。
2. jinfo 查看配置信息报错
- 详细报错信息如下
$ jinfo -flags 26284
Attaching to process ID 26284, 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)
PS: 此处 JDK 版本为 java version “1.8.0_191”
查资料说是 JVM 的 bug(链接:https://bugs.java.com/bugdatabase/view_bug.do?bug_id=8160376
),在 JDK 9 b129 修复了。
因此,可以换个较高版本的 JDK。
持续更新中……