Binu John's Weblog

Wednesday Apr 01, 2009

GlassFish V3 profiling

I have been using JProfiler and BTrace for the performance analysis of GlassFish V3. Things were working well until I picked up build 42 last week. With this build, I was unable to attach BTrace or the profiler (I haven't checked whether the latest version of JProfiler fixes this problem). The server throws a NoClassDefFoundError while loading the BTrace script as shown in the sample below. A similar exception is thrown while trying to load com.jprofiler.* classes.

java.lang.NoClassDefFoundError: com/sun/btrace/samples/MethodPerfMeasurementLast
        at com.sun.grizzly.http.
ProcessorTask.$btrace$com$sun$btrace$samples$MethodPerfMeasurementLast$onMethodEnter(ProcessorTask.java)
        at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java)     
        at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:615)           
        at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:895)
        at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:162)
        at com.sun.enterprise.v3.services.impl.GlassfishProtocolChain.executeProtocolFilter
(GlassfishProtocolChain.java:71)

... 

This is due to changes made in the Felix's bootdelegation. Snippets from the configuration file, felix/conf/config.properties for build 40 and 42 are shown below.

build 40:  org.osgi.framework.bootdelegation=*

build 42: org.osgi.framework.bootdelegation=org.xml.sax.*, org.w3c.*, javax.*

Peter Kriens has a good blog, A Strong Lesson About Modularity, that describes bootdelegation, I suggest you check it out.

In order to get Jprofiler and BTrace to work, I had to modify the configuration file (thanks Jerome for the pointer) as follows -

org.osgi.framework.bootdelegation=org.xml.sax.*, org.w3c.*, javax.*, com.jprofiler.*, com.sun.btrace.* 

Once this change was made, I was able to get the profilers working.

Comments:

Post a Comment:
Comments are closed for this entry.

Calendar

Feeds

Search

Links

Navigation

Referrers