Troubleshooting Tools on Solaris OS and Linux for Java SE 5.0

Monitoring Tools
Debugging Tools


Monitoring Tools

JConsole

Launch a GUI to monitor and manage Java applications and Java VMs on a local or remote machine.

  • Connection to Java process or host.
  • Summary of key data, for example, uptime, compilation time, objects pending finalization, and more.
  • Memory statistics, including garbage collection.
  • Request garbage collection.
  • Thread statistics.
  • Class statistics.
  • Tree structure of all platform and application MBeans.
  • Set the value of an MBean attribute.
  • Subscribe to notification for an MBean.
  • Information about the virtual machine, the compiler, the operating system.

jps

List instrumented Java virtual machines.

jstat

http://docs.oracle.com/javase/1.5.0/docs/tooldocs/share/jstat.html

Display performance statistics for an instrumented Java VM:

  • Behavior of the class loader
  • Behavior of the HotSpot Just-in-Time compiler, totals and by method
  • Behavior of the GC heap
  • Behavior and sizes of the generation areas

jstatd

  • Monitor for creation and termination of instrumented HotSpot Java VMs.
  • Provide an interface for remote monitoring tools to attach to Java VMs.

Debugging Tools

Heap Analysis Tool (HAT)

Parse a binary heap dump, launch a web browser, and present standard queries.

  • Execute standard queries, for example, classes, objects, class instances, reference chains from object rootset, reachable objects, and more.
  • Specify objects to exclude from "reachable objects" query.
  • Pass flags to the Java VM on which jhat is running.
  • Compare objects in two dumps.

For detailed information, see J2SE 5.0 Troubleshooting and Diagnostic Guide (pdf)

HPROF profiler

Writes class profiling information to a file or a socket, in ASCII or binary.

  • Heap allocation profiling.
  • Heap dump.
  • CPU usage - for threads, methods.
  • Monitor contention profiling.

To invoke the HPROF tool: java -agentlib:hprof ToBeProfiledClass

To print the complete list of options: java -agentlib:hprof=help

jdb

Launch a simple interactive command-line debugger.

  • Display Java objects and primitive values.
  • List currently running threads.
  • Dump the current thread stack.
  • Set breakpoints.
  • Step through execution.
  • Examine exceptions.

jinfo

Print Java configuration information (command line flags and system properties) for a running process, from a core file, or for a remote debug server.

jmap

Print memory information for a process, a core file, or a remote debug server.

  • Print shared object mappings for a process, a core file, or a remote debug server.
  • Print a heap summary for a process, a core file, or a remote debug server.
  • Print a histogram of all objects of a process, a core file, or a remote debug server.
  • Print class loader statistics of the permanent generation.
  • Pass flags to the VM.

jsadebugd

Serviceability Agent Debug Daemon, which acts as debug server.

  • Attach to a Java process or a core file.
  • Remote clients can attach to the server using RMI.

jstack

Print stack traces of threads for a process, core file, or remote debug server