Java Troubleshooting Guide for HP-UX Systems

Young generation collection. The screen is comprised of 32 identically sized regions, one for each
possible object age. Each region represents 100% of the active Survivor Space and is filled with
a colored area that indicates the percentage of the survivor space occupied by objects of the given
age.
The following figure is an example of the Survivor Age Histogram screen:
Figure 1-18 visualgc Survivor Age Histogram Screen
When the Java VM is started with the Parallel Young GC option (-XX:+UseParallelGC), the
Survivor Age Histogram screen is not displayed because the Parallel Young collector does not
maintain a survivor age histogram because it applies a different policy for maintaining objects
in the survivor spaces.
1.24 -Xcheck:jni
The -Xcheck:jni option is useful when trying to diagnose problems with applications that
use the Java Native Interface (JNI). Sometimes there are bugs in the native code that cause the
Java VM to crash or behave incorrectly. Add the -Xcheck:jni option to the command line
when starting the application. For example:
$ java -Xcheck:jni MyApplication
The -Xcheck:jni tells the Java VM to do additional validation on the arguments passed to JNI
functions. This option may not find all invalid arguments or diagnose logic bugs in the application
code; however, it can help diagnose these types of problems.
When an invalid argument is detected, the Java VM prints a message to the application console
(standard output), prints the stack trace of the offending thread, and aborts the Java VM. The
following example shows where a NULL is incorrectly passed to a JNI function that does not
allow NULL:
FATAL ERROR in native method: Null object passed to JNI
at java.net.PlainSocketImpl.socketAccept(Native Method)
at java.net.PlainSocketImpl.accept(PlainSocketImpl.java:343)
- locked <0x450b9f70> (a java.net.PlainSocketImpl)
at java.net.ServerSocket.implAccept(ServerSocket.java:439)
at java.net.ServerSocket.accept(ServerSocket.java:410)
at org.apache.tomcat.service.PoolTcpEndpoint.acceptSocket(PoolTcpEndpoint.java:286)
at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:402)
at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:498)
at java.lang.Thread.run(Thread.java:536)
The following example shows output that is displayed when something other than a jfieldID is
provided to a JNI function that expects a jfieldID:
FATAL ERROR in native method: Instance field not found in JNI get/set field operations
at java.net.PlainSocketImpl.socketBind(Native Method)
at java.net.PlainSocketImpl.bind(PlainSocketImpl.java:359)
-locked <0xf082f290> (a java.net.PlainSocketImpl)
at java.net.ServerSocket.bind(ServerSocket.java:318)
at java.net.ServerSocket.<init>(ServerSocket.java:185)
at jvm003a.<init>(jvm003.java:190)
at jvm003a.<init>(jvm003.java:151)
at jvm003.run(jvm003.java:51)
at jvm003.main(jvm003.java:30)
The types of problems that -Xcheck:jni can help diagnose are:
1.24 -Xcheck:jni 45