Generating a Java stack trace with the PERFORM JVMSERVER SPI

The PERFORM JVMSERVER(jvmserver) JVM STACKTRACE generate a Java stack trace for a JavaJava thread that is run on a CICS® task.

About this task

This command provides a method of generating a stack trace of the Java thread that is running a CICS task. The stack trace gives a report of the Java call stack at the current point in time during execution. It can be used to understand in what method a Java application is suspended, and how that method was run.

When the command is issued, the Java thread that is bound to the CICS task is located, then a stack trace is generated to the JVM log file (dfhjvmlog) for that thread.

Procedure

  1. Identify the CICS task number of the Java thread.

    The INQUIRE TASK SPI can be used to identify long-running tasks. The INQUIRE PROGRAM SPI can be used to identify which of these tasks are Java programs.

  2. Run the PERFORM JVMSERVER(jvmserver) JVM STACKTRACE TASK(tasknum) command.

Results

A stack trace of the Java thread that was run on the CICS task with the specified task number is produced in the JVM log file (dfhjvmlog) of the JVM server.

Example

Figure 1. Example output in the JVM log file for a stack trace of task 42.
2024/01/01 00:00:00.000000 UTC ? [EVENT_RESPONDER] [com.ibm.cics.jvmserver.spi] [StackTraceAction] @System: driveCommand() - Dump of thread "JVMSERV.TASK42.TRAN", CICS task: "42", state: TIMED_WAITING, priority: 5
    java.lang.Thread.sleepImpl(Native Method)
    java.lang.Thread.sleep(Thread.java:977)
    java.util.concurrent.TimeUnit.sleep(TimeUnit.java:397)
    com.example.App.main(App.java:42)
    ...