users@glassfish.java.net

java.lang.NoClassDefFoundError: com/sun/demo/jvmti/hprof/Tracker

From: Yuji Kubota <jarkeys_at_gmail.com>
Date: Thu, 27 Sep 2012 15:29:33 +0900

Hello, there.
I want to report the problem and solution when I try to use hprof with
GlassFish Server Open Source Edition v 3.1.2.2.

* Problem

Set the configuration such as below link (Development Guide) to use hprof.
http://docs.oracle.com/cd/E18930_01/html/821-2418/beafn.html
And restart GlassFish Server to enable hprof, however, GlassFish
Server get java.lang.NoClassDefFoundError and stop with attached
stacktrace.

After GlassFish Server v 3.1.x (Open Source Edition and Oracle
GlassFish Server) have same problem.
I can use hprof with above configuration at GlassFish Server v 3.1.

* Solution

This NoClassDefFoundError are caused by classpath problem of Apache Felix.
The OSGi bundles which are started by Felix platform can't solve the classpath.

Edit configration file of Apache Felix to add the classpath at
"org.osgi.framework.bootdelegation".
    $ vi {installdir}/glassfish/config/osgi.properties
    org.osgi.framework.bootdelegation=com.sun.demo.jvmti.hprof,
com.sun.demo.jvmti.hprof.*, .....
And restart GlassFish Server to enable hprof.

Thanks,