Getting verbose class loading output in GlassFish
Java VM has a standard option called -verbose as shown by java -help:
-verbose[:class|gc|jni]
enable verbose output
To diagnose class loading issues, you need to specify -verbose:class. It's straight forward to use if you are launching the Java process yourself. How does a GlassFish user use this?
Option #1: Using java command directly
If you (like me) are starting glassfish using java command directly, then you could easily specify in your command output and you will see each class loading getting logged with a source of the class (You would like to redirect the output as there are just so much output that your terminal buffer may not be sufficient to capture the entire output):
java -verbose:class -jar glassfish/modules/glassfish.jar
Option #2: Starting GlassFish in foreground using start-domain command
Even if you are using start-domain command to start the server, I recommend starting GlassFish in foreground using "-v" option of start-domain so that the jvm log and server log appear in console output like option #1, thus allowing you to corelate them better. You would like to redirect the output just like previous case as well. In this case, you just need the following setting in domain.xml:
<jvm-options>-verbose:class</jvm-options>
and start server like this:
asadmin start-domain -v
Option #3: Starting GlassFish in background using start-domain command
If you are using asadmin start-domain command to start GlassFish in background, then you have to add the following jvm options in jvm-options section of your domain.xml:
<jvm-options>-verbose:class</jvm-options>
<jvm-options>-XX:LogFile=${com.sun.aas.instanceRoot}/logs/jvm.log</jvm-options>
<jvm-options>-XX:+LogVMOutput</jvm-options>
In this case, the jvm.log will be next to server.log in logs directory. You are relying on proprietary JVM options here.
Because I forget about these additional options, I decided to write them down here.
- Login or register to post comments
- Printer-friendly version
- ss141213's blog
- 1703 reads





