Skip to content

hughjfchen/collect-java-dump

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Readme

collect-java-dump is a simple tool based on jattach and IBM Java Surgery to help generate java threadump and heapdump for diagnozing java application problems.

Why would you need this?

After all, there should be java on the host where the application was running and you want to collect dumps, why would I need this?

Well, there’re some situations you would like this script:

  1. Only JRE installed on the machine where your java application’s running and that means you cannot use the java tools to collect dumps because they’re included in JDK. This situation is very common for a container environment.
  2. There’re a couple of different JDKs and the ways to collect dumps are different. You don’t want to bother these.

Supported JVMs

Currently, the following JVMs would be supported by this script:

  • OpenJDK
  • HotSpot
  • OpenJ9
  • IBM J9

How to build

Clone this repository to your local disk and change your working directory into the collect-java-dump sub directory and simply use the following command to build script:

./deploy any production

This will generate a script with the name my-collect-java-dump-any-production-dist-yyyymmddhhMMss.sh where yyyymmddhhMMss is the time when the script was being built. The script is self-executable and the dependencies have been packaged into the script, so you just copy this script to any machine and it should run without any problem.

How to use

The jattach and the IBM Java Surgery have been packaged into the script so just run the script giving the PID of the JVM or the WebSphere application server name. For example:

my-collect-java-dump-any-production-dist-yyyymmddhhMMss.sh <PID of the JVM> | <WebSphere application server name>

Note

Following must be noticed while using this script:

  • This script must run with root or a user with sudo and no need to prompt password
  • For WebSphere application server, the JDK must be above 8
  • Heapdump may be very large, so it takes time for generating heapdump

About

collect java thread and heap dump using jattach.

Resources

Stars

Watchers

Forks

Packages

No packages published