OSGi and Java Profiling

November 14, 2023

As the OSGi framework consists of many class loaders interacting with each other, the usage of a profiling tool, especially one that uses instrumentation such as YourKit, often requires some custom framework settings.

Here is an example on how to configure YourKit for profiling Jahia. In the WEB-INF/etc/config/felix-framework.properties, make sure you have the YourKit packages declared in the bootdelegation property:

org.osgi.framework.bootdelegation=sun.*,com.sun.*,com.sun.jndi.ldap,com.yourkit.*,__redirected

If using another profiler, you might have to also add the profiler packages to the boot delegation property. By default, Jahia comes pre-configured for profiling with YourKit. You can find an interesting blog entry that gives example for different profilers here: http://blog.knowhowlab.org/2010/03/osgi-tips-osgi-profiling-yourkit.html