Windowsサーバーにて、Javaのコアダンプを意図的に出力したいと思いっています。
プロセスを強制終了しても出力されないので、出力方法をご存知の方がいらっしゃれば教えていただければ幸いです。
環境
Java(TM) SE Development Kit 11.0.12(64-bit)
WindowsServer 2019
「Javaのコアダンプ」とのことですが、Java のスレッドダンプでしょうか?
それであれば、まず jps でプロセスIDを特定します。
C:\> "C:\Program Files\Java\jdk-11.0.12.7\bin\jps.exe"
17616 JShellToolProvider
17812 Jps
17816 RemoteExecutionControl
次に、そのプロセスIDを指定して jstack を実行します。
C:\> "C:\Program Files\Java\jdk-11.0.12.7\bin\jstack.exe" 17616
2022-09-05 23:20:43
Full thread dump OpenJDK 64-Bit Server VM (18.0.2+9 mixed mode, sharing):
Threads class SMR info:
_java_thread_list=0x000001b03aa6f0c0, length=20, elements={
0x000001b00f4869b0, 0x000001b00f54dc10, 0x000001b00f54ea70, 0x000001b0357a79a0,
0x000001b0357a8340, 0x000001b0357a8ce0, 0x000001b0357a9680, 0x000001b0357adad0,
0x000001b0357b8620, 0x000001b0357bb010, 0x000001b039c9c2d0, 0x000001b039d30460,
0x000001b039fea160, 0x000001b039ff0650, 0x000001b03a348110, 0x000001b03a37a600,
0x000001b03a464af0, 0x000001b03b8ec410, 0x000001b03b503fa0, 0x000001b03b504470
}
"main" #1 prio=5 os_prio=0 cpu=1703.12ms elapsed=161.23s tid=0x000001b00f4869b0 nid=2568 in Object.wait() [0x000000631f7fe000]
java.lang.Thread.State: TIMED_WAITING (on object monitor)
at java.lang.Object.wait([email protected]/Native Method)
- waiting on <no object reference available>
at jdk.internal.org.jline.utils.NonBlockingInputStreamImpl.read([email protected]/NonBlockingInputStreamImpl.java:139)
- locked <0x00000006e02d91c0> (a jdk.internal.jshell.tool.ConsoleIOContext$1)
at jdk.internal.org.jline.utils.NonBlockingInputStream.read([email protected]/NonBlockingInputStream.java:62)
at jdk.internal.org.jline.utils.NonBlocking$NonBlockingInputStreamReader.read([email protected]/NonBlocking.java:168)
at jdk.internal.org.jline.utils.NonBlockingReader.read([email protected]/NonBlockingReader.java:57)
at jdk.internal.org.jline.keymap.BindingReader.readCharacter([email protected]/BindingReader.java:160)
at jdk.internal.org.jline.keymap.BindingReader.readBinding([email protected]/BindingReader.java:110)
at jdk.internal.org.jline.keymap.BindingReader.readBinding([email protected]/BindingReader.java:61)
at jdk.internal.org.jline.reader.impl.LineReaderImpl.doReadBinding([email protected]/LineReaderImpl.java:923)
at jdk.internal.org.jline.reader.impl.LineReaderImpl.readBinding([email protected]/LineReaderImpl.java:956)
at jdk.internal.jshell.tool.ConsoleIOContext$2.readBinding([email protected]/ConsoleIOContext.java:173)
at jdk.internal.org.jline.reader.impl.LineReaderImpl.readLine([email protected]/LineReaderImpl.java:651)
at jdk.internal.org.jline.reader.impl.LineReaderImpl.readLine([email protected]/LineReaderImpl.java:468)
at jdk.internal.jshell.tool.ConsoleIOContext.readLine([email protected]/ConsoleIOContext.java:249)
at jdk.internal.jshell.tool.JShellTool.getInput([email protected]/JShellTool.java:1281)
at jdk.internal.jshell.tool.JShellTool.run([email protected]/JShellTool.java:1215)
at jdk.internal.jshell.tool.JShellTool.start([email protected]/JShellTool.java:1001)
at jdk.internal.jshell.tool.JShellToolBuilder.start([email protected]/JShellToolBuilder.java:261)
at jdk.internal.jshell.tool.JShellToolProvider.main([email protected]/JShellToolProvider.java:120)
(略)