With a core file, we can use the debugger (GDB) to inspect the state of the process at the moment it was terminated and to identify the line of code that caused the problem. That's a situation where a core dump file could be produced, but it's not by default.
If you have a heap dump file saved on your local system, you can open the file in Java VisualVM by choosing File > Load from the main menu. Java VisualVM can open heap dumps saved in the . hprof file format. When you open a saved heap dump, the heap dump opens as a tab in the main window.
To find the long running threads, highlight all the thread dumps you want to check, and then click on the binoculars: In the pop up dialogue, click start detection, and you'll get your long running threads just below the dumps themselves: In my example, each thread dump has 157 threads.
Okay if you've created the core dump with gcore or gdb then you'll need to convert it to something called a HPROF file. These can be used by VisualVM, Netbeans or Eclipse's Memory Analyzer Tool (formerly SAP Memory Analyzer). I'd recommend Eclipse MAT.
To convert the file use the commandline tool jmap.
# jmap -dump:format=b,file=dump.hprof /usr/bin/java core.1234
where:
dump.hprof is the name of the hprof file you wish to create
/usr/bin/java is the path to the version of the java binary that generated the core dump
core.1234 is your regular core file.
If you are using an IBM JVM, download the IBM Thread and Monitor Dump Analyzer. It is an excellent tool. It provides thread detail and can point out deadlocks, etc. The following blog post provides a nice overview on how to use it.
Maybe VisualVM can help (haven't yet had a chance to try it myself). Link:
http://java.sun.com/javase/6/docs/technotes/guides/visualvm/coredumps.html
Are you sure a core dump is what you want here? That will contain the raw guts of the running JVM, rather than java-level information. Perhaps a JVM heap dump is more what you need.
Actually, VisualVM can process application core dump.
Just invoke "File/Add VM Coredump" and will add a new application in the application explorer. You can then take thread dump or heap dump of that JVM.
See http://www.oracle.com/technetwork/java/javase/tsg-vm-149989.pdf. You can use "jdb" directly on the core file.
Try the lady4j stack analyzer, it could help you:
http://www.lady4j.com/solveStack.jsp
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With