4.7.2 When using separate commands
The method to output a thread dump differs depending on the JavaVM start option in which the specified J2EE server is running.
-
When -XX:+HitachiThreadDump is set, you can acquire the extended thread dump. This option is set by default.
-
If -XX:+HitachiThreadDumpToStdout is set, a thread dump is also output to the standard output. This option is not set by default. Set this option if required.
-
When the following startup options are set, if -XX:+HitachiOutOfMemoryAbortThreadDump is set, a thread dump is output when forced termination is performed using OutOfMemoryError
-
-XX:+HitachiOutOfMemoryAbort
-
-XX:+HitachiThreadDump
Except in the following cases:
-
When C heap is insufficient in the J2SE class library
-
When C heap is insufficient in JavaVM processing
-
-
When the following startup options are set, if -XX:+HitachiOutOfMemoryAbortThreadDumpWithJHeapProf is set, a class wise statistical information is output in the thread dump when forced termination is performed using OutOfMemoryError. For details about the class-wise statistical information, see 9.3 Class-wise statistical functionality. The class-wise statistical information, which is output while setting this above-mentioned option, is same as the information acquired when executing the jheapprof command.
-
-XX:+HitachiOutOfMemoryAbort
-
-XX:+HitachiOutOfMemoryAbortThreadDump
-
-XX:+HitachiThreadDump
-
- Organization of this subsection
(1) Acquiring J2EE server thread dump
If the J2EE server process (cjstartsv) exists, the J2EE server thread dump is acquired by executing the cjdumpsv command. An example of executing the cjdumpsv command is described below. As the transition status of each thread is to be confirmed over a period of time, execute the cjdumpsv command multiple times. Execute about 10 times every 3 seconds.
-
In Windows
Cosminexus-installation-directory\CC\server\bin\cjdumpsv J2EE-server-name
-
In UNIX
/opt/Cosminexus/CC/server/bin/cjdumpsv J2EE-server-name
When you execute the cjdumpsv command, the JavaVM thread dump is output to the following files:
-
Server standard output log
-
working-directory\ejb\server-name\javacoreprocess-number.command-execution-date-and-time.txt (in Windows)
-
working-directory/ejb/server-name/javacoreprocess-number.command-execution-date-and-time.txt (in UNIX)
The default output destination of the server standard output log is ejb.server.log.directory\CC\maintenance\cjstdout.log (in Windows) or ejb.server.log.directory/CC/maintenance/cjstdout.log (in UNIX). For details about changing the output destination, see 4.3 Application Server log (Systems for executing J2EE applications) or see 4.4 Application Server log (Systems for executing batch applications). Note that the default directory path of the working directory is Cosminexus-installation-directory\CC\server\public (in Windows) or /opt/Cosminexus/CC/server/public (in UNIX).
Furthermore, the output destination of the javacore process-number.command-execution-date-and-time.txt file can be changed with the environmental variable JAVACOREDIR. However, when writing to a specified directory fails, javacore process-number.command-execution-date-and-time.txt file is output to the default output destination. When it is not possible to output even to this directory, it is output only to the standard error output.
For details about the cjdumpsv command, see cjdumpsv (get thread dump of J2EE server) in the uCosminexus Application Server Command Reference Guide.
- Reference note
-
When a thread dump is output, the following message is output to the standard output and the execution of the java program is continued. This message is output irrespective of the -XX:+HitachiThreadDumpToStdout settings.
Writing Java core to full-file-path-name...OK
(2) Acquiring the CORBA naming service thread dump
In Windows, when the CORBA naming service process (nameserv) exists, press the Ctrl+Break key on the command prompt from where the CORBA naming service is started. As the transition status of each thread is to be confirmed over a period of time, execute it multiple times. Execute about 10 times every 3 seconds. Note that you cannot acquire a thread dump if the CORBA naming service is monitored from the Management Server.
In UNIX, if the CORBA naming service process (java) exists, execute the kill command, and acquire a thread dump of the CORBA naming service. Note that you cannot acquire a thread dump if the CORBA naming service is monitored from the Management Server.
To acquire a thread dump of the CORBA naming service in UNIX:
-
Acquire the process ID of the CORBA naming service.
The method of acquiring the process ID of the CORBA naming service differs depending on the following cases:
- When no other java process is started
ps -ef | grep java
- When multiple java processes are started
-
If the shell script for starting the CORBA naming service is used, you can output the process ID of the CORBA naming service in the namesv_pid file generated in the current working directory.
An example of the shell script for starting the CORBA naming service is as follows:
#!/bin/sh export VBROKER_ADM=/opt/Cosminexus/TPB/adm export SHLIB_PATH="${SHLIB_PATH}:/opt/Cosminexus/TPB/lib" # start name server process exec /opt/Cosminexus/TPB/bin/nameserv \ -J-Dvbroker.agent.enableLocator=false \ -J-Djava.security.policy==/opt/Cosminexus/CC/server/sysconf/cli.policy \ -J-Dvbroker.se.iiop_tp.scm.iiop_tp.listener.port=900 & # save background java process pid echo $! > ./namesv_pid
-
Specify the acquired process ID, and execute the kill command.
kill -3 `cat namesv_pid`
(3) Acquiring a thread dump of EJB client applications
Acquire a thread dump of EJB client applications by executing the cjcldumpap command.
When the cjcldumpap command is executed, a thread dump of the EJB client application started by executing the cjclstartap command is output. Moreover, it is also possible to output a thread dump for a specific process. For details about the cjcldumpap command, see cjcldumpap (get thread dump of Java application) in the uCosminexus Application Server Command Reference Guide.
The execution format, execution example, and thread dump output destination of the cjcldumpap command are as follows:
- Execution format
-
- To output a thread dump of an EJB client application started with the cjclstartap command
cjcldumpap
- To output a thread dump for a specific process
cjcldumpap process-ID
- Execution example
-
- To output a thread dump of an EJB client application started with the cjclstartap command
cjcldumpap
- To output a thread dump for a specific process
cjcldumpap 3264
- Output destination
-
Current directory from where the cjclstartap command is executed