wang ming
wang ming

Reputation: 199

Why `sun.jvm.hotspot.debugger.DebuggerException: cannot open binary file`?

In linux, I got a core file generated by java, it can't be opened by jvisualvm ,so I want to translate it to a heap dump file , but occured some error :

[root@root_test-1 game]$ jmap -J-d64 -dump:format=b,file=core.10255.dump java ./core.10255
Attaching to core ./core.10255 from executable java, please wait...
Error attaching to core file: cannot open binary file
sun.jvm.hotspot.debugger.DebuggerException: cannot open binary file
        at sun.jvm.hotspot.debugger.linux.LinuxDebuggerLocal.attach0(Native Method)
        at sun.jvm.hotspot.debugger.linux.LinuxDebuggerLocal.attach(LinuxDebuggerLocal.java:286)
        at sun.jvm.hotspot.HotSpotAgent.attachDebugger(HotSpotAgent.java:673)
        at sun.jvm.hotspot.HotSpotAgent.setupDebuggerLinux(HotSpotAgent.java:611)
        at sun.jvm.hotspot.HotSpotAgent.setupDebugger(HotSpotAgent.java:337)
        at sun.jvm.hotspot.HotSpotAgent.go(HotSpotAgent.java:304)
        at sun.jvm.hotspot.HotSpotAgent.attach(HotSpotAgent.java:156)
        at sun.jvm.hotspot.tools.Tool.start(Tool.java:191)
        at sun.jvm.hotspot.tools.Tool.execute(Tool.java:118)
        at sun.jvm.hotspot.tools.HeapDumper.main(HeapDumper.java:83)
        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:497)
        at sun.tools.jmap.JMap.runTool(JMap.java:201)
        at sun.tools.jmap.JMap.main(JMap.java:130)

How to fix it?

Upvotes: 1

Views: 9468

Answers (1)

Fairoz
Fairoz

Reputation: 1666

It does look like you are using bit older(JDK8 update 60 or lesser) version of java. The issue you have mentioned is known issue https://bugs.openjdk.java.net/browse/JDK-8039995 this has been already fixed in JDK9 and backported to varies lower versions (JDK8 update 65 is the lowest). You need to upgrade your java to use latest version to avoid this issue.

Upvotes: 1

Related Questions