

Windowsサーバーにて、Javaのコアダンプを意図的に出力したいと思いっています。  
プロセスを強制終了しても出力されないので、出力方法をご存知の方がいらっしゃれば教えていただければ幸いです。

環境  
Java(TM) SE Development Kit 11.0.12(64-bit)  
WindowsServer 2019


CC BY-SA 4.0
2022-08-29T08:25:58.793
90821
2022-09-05T14:25:40.037
54195
question
java windows-server logging
Windowsサーバーにて、javaのcoredumpを意図的に出力したい


[JDKのドキュメント](https://docs.oracle.com/en/java/javase/11/troubleshoot/diagnostic-
tools.html#GUID-C7CC8F8A-E763-4EE2-BC41-CA7E1086570B)には[userdumpコマンド](https://docs.microsoft.com/ja-
jp/troubleshoot/windows-server/performance/use-userdump-create-dump-
file)の利用例がありました。


CC BY-SA 4.0
2022-08-29T10:44:38.527
90822
2022-08-29T10:44:38.527
241
90821
answer


「Javaのコアダンプ」とのことですが、Java のスレッドダンプでしょうか？

それであれば、まず **jps** でプロセスIDを特定します。

[code]

    C:\> "C:\Program Files\Java\jdk-11.0.12.7\bin\jps.exe"
    17616 JShellToolProvider
    17812 Jps
    17816 RemoteExecutionControl
    
[/code]

次に、そのプロセスIDを指定して **jstack** を実行します。

[code]

    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(java.base@18.0.2/Native Method)
            - waiting on <no object reference available>
            at jdk.internal.org.jline.utils.NonBlockingInputStreamImpl.read(jdk.internal.le@18.0.2/NonBlockingInputStreamImpl.java:139)
            - locked <0x00000006e02d91c0> (a jdk.internal.jshell.tool.ConsoleIOContext$1)
            at jdk.internal.org.jline.utils.NonBlockingInputStream.read(jdk.internal.le@18.0.2/NonBlockingInputStream.java:62)
            at jdk.internal.org.jline.utils.NonBlocking$NonBlockingInputStreamReader.read(jdk.internal.le@18.0.2/NonBlocking.java:168)
            at jdk.internal.org.jline.utils.NonBlockingReader.read(jdk.internal.le@18.0.2/NonBlockingReader.java:57)
            at jdk.internal.org.jline.keymap.BindingReader.readCharacter(jdk.internal.le@18.0.2/BindingReader.java:160)
            at jdk.internal.org.jline.keymap.BindingReader.readBinding(jdk.internal.le@18.0.2/BindingReader.java:110)
            at jdk.internal.org.jline.keymap.BindingReader.readBinding(jdk.internal.le@18.0.2/BindingReader.java:61)
            at jdk.internal.org.jline.reader.impl.LineReaderImpl.doReadBinding(jdk.internal.le@18.0.2/LineReaderImpl.java:923)
            at jdk.internal.org.jline.reader.impl.LineReaderImpl.readBinding(jdk.internal.le@18.0.2/LineReaderImpl.java:956)
            at jdk.internal.jshell.tool.ConsoleIOContext$2.readBinding(jdk.jshell@18.0.2/ConsoleIOContext.java:173)
            at jdk.internal.org.jline.reader.impl.LineReaderImpl.readLine(jdk.internal.le@18.0.2/LineReaderImpl.java:651)
            at jdk.internal.org.jline.reader.impl.LineReaderImpl.readLine(jdk.internal.le@18.0.2/LineReaderImpl.java:468)
            at jdk.internal.jshell.tool.ConsoleIOContext.readLine(jdk.jshell@18.0.2/ConsoleIOContext.java:249)
            at jdk.internal.jshell.tool.JShellTool.getInput(jdk.jshell@18.0.2/JShellTool.java:1281)
            at jdk.internal.jshell.tool.JShellTool.run(jdk.jshell@18.0.2/JShellTool.java:1215)
            at jdk.internal.jshell.tool.JShellTool.start(jdk.jshell@18.0.2/JShellTool.java:1001)
            at jdk.internal.jshell.tool.JShellToolBuilder.start(jdk.jshell@18.0.2/JShellToolBuilder.java:261)
            at jdk.internal.jshell.tool.JShellToolProvider.main(jdk.jshell@18.0.2/JShellToolProvider.java:120)
    
    （略）
    
[/code]


CC BY-SA 4.0
2022-09-05T14:25:40.037
90944
2022-09-05T14:25:40.037
14334
90821
answer