我的要求是使用 Jmap 创建一个远程服务器的堆内存转储文件。我是这样做的。
jmap -dump:file=remoteDump.txt,format=b 3104
这很好用,因为 3104 是我本地机器上进程的 pid。我如何对远程服务器执行相同操作?我试过
jmap -dump:file=remoteDump.txt,format=b 3104 54.197.228.33:8080
但它失败了。我尝试使用 jsadebugd 创建调试服务器,如下所示。1.启动rmiregistry
rmiregistry -J-Xbootclasspath/p:$JAVA_HOME/lib/sa-jdi.jar
2.运行jsadebugd
>jsadebugd 11594 54.197.228.33:9009
但是第2步抛出以下错误:
Error attaching to process or starting server: sun.jvm.hotspot.debugger.D
Exception: Windbg Error: WaitForEvent failed!
at sun.jvm.hotspot.debugger.windbg.WindbgDebuggerLocal.attach0(Na
thod)
at sun.jvm.hotspot.debugger.windbg.WindbgDebuggerLocal.attach(Win
ggerLocal.java:152)
at sun.jvm.hotspot.HotSpotAgent.attachDebugger(HotSpotAgent.java:
at sun.jvm.hotspot.HotSpotAgent.setupDebuggerWin32(HotSpotAgent.j
)
at sun.jvm.hotspot.HotSpotAgent.setupDebugger(HotSpotAgent.java:3
at sun.jvm.hotspot.HotSpotAgent.go(HotSpotAgent.java:313)
at sun.jvm.hotspot.HotSpotAgent.startServer(HotSpotAgent.java:220
at sun.jvm.hotspot.DebugServer.run(DebugServer.java:106)
at sun.jvm.hotspot.DebugServer.main(DebugServer.java:45)
at sun.jvm.hotspot.jdi.SADebugServer.main(SADebugServer.java:55)
帮我摆脱它。