javacore (Acquiring the core file and thread dump/in UNIX)
- Organization of this page
Format
javacore [-i|-f] [-force] -p process-ID
Function
This command collects a core file and a thread dump simultaneously during execution. This command is for UNIX only.
Arguments
- -i
-
Displays the messages for checking the execution of the core file and the thread dump output process. Enter y or n for the displayed messages. In such cases, when you enter y, the thread dump is output and when you enter n, the process ends without performing any operation. When omitted, this option is valid as long as the -f option is not specified.
- -f
-
Invalidates the -i option. If omitted, the -i option is enabled.
- -force
-
Outputs core for the java process with the process ID specified in the -p option without confirming the existence of the /tmp/hsperfdata_user-name/process-ID file created with the java process.
- -p process-ID
-
Specifies the process ID of the Java program from which the core file and thread dump are to be collected.
Return values
- 0:
-
The command terminated normally.
- 1:
-
The command terminated abnormally.
- 2:
-
The core generation process did not return a response within the specified timeout time.
Input example
-
Execution of the javacore command, with the -f option omitted:
javacore -p 8326
-
A message for confirming the execution of the core file and the thread dump output process is displayed:
send SIGQUIT to 8326:?(y/n)
-
Enter y to collect the core file and thread dump (otherwise enter n):
send SIGQUIT to 8326:?(y/n)y
-
When the core file and thread dump are collected, the Java program being executed outputs the following message:
Now generating core file (javacore8662.030806215140.core)... done (thread-dump-output) Writing Java core to javacore8662.030806215140.txt... OK
-
The Java program being executed creates the following files under the current directory and continues the program:
- Core file
-
javacoreprocess-id.time.core
- Thread dump
-
javacoreprocess-id.time.txt
Output messages
If any of the error messages described below or a warning message is issued, the core file and thread dump have not been collected.
No. |
Error message |
Explanation |
---|---|---|
1 |
usage: javacore [-f|-i] [-force] -p process-id |
A command argument is invalid. |
2 |
javacore: can't create work file at /tmp, this request canceled |
The user does not have permission to reference or write data into /tmp. |
3 |
javacore: illegal option --option |
The indicated option specified in the command arguments is invalid. |
4 |
javacore: unexpected error occurred: error-cause |
An unexpected error occurred during command execution. |
5 |
javacore: please delete name-of-undeleted-file in full-path-of-undeleted-file |
When the command terminated, a file created by the internal process of the javacore command could not be deleted. Delete the non-deleted file in the full-path-of-the-non-deleted-file. |
6 |
process-id: No such process |
No process is found that matches the process indicated by process-id specified in the argument of the javacore command or the process indicated by process-id specified in the javacore command is not the java process. |
7 |
process-id: Not owner |
The executing user is not the owner of the process indicated by process-id specified in the command. |
8 |
process-id: Now processing previous request, this request canceled |
The process indicated by process-id specified in the command is currently generating a core. |
9 |
process-id: Timeout occurred. Java process not responding. |
The process indicated by process-id specified in the argument of the command does not return a response indicating that the core output processing terminated within the fixed time. |
Notes
-
The javacore command sends the SIGQUIT signal to the specified process. If a program other than a Java program is specified by mistake, other programs may stop.
-
The javacore command cannot be executed concurrently for the same Java process. You execute the command after the core output processing by the previous javacore command has terminated.
-
If a Java VM process has not responded to a thread dump collection request and has gone onto no-response status, you cannot use the javacore command to collect the core file. In such a case, execute the kill -6 command to terminate the Java VM process forcibly, then collect the core file.
-
In Linux, generate core with the gcore command of gdb. If gdb is not installed, the following error message will be output as the standard output:
Error occurred in generating core file, gdb not found.
Furthermore, if the installed gdb is from an old version, the following message will be output as the standard output:
Error occurred in generating core file, gdb version 5.2 or later needed.
-
The javacore command uses the /tmp/hsperfdata_user-name/process-ID file at runtime. If the applicable file does not exist, the core file cannot be output by the javacore command. However, if the -force option is specified, core is output for the Java process indicated by the process ID that is specified in the -p option without confirming the existence of the /tmp/hsperfdata_user-name/process-ID file.