Blog

  • 2024
  • 2023
  • 2022
  • 2021
  • 2020
  • 2019
  • 2018
  • 2017
  • 2016
  • 2015
  • 2014
  • 2013
  • 2012

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

When trying to instrument a locally via the Atlassian SDK started Confluence with the Java VisualVM for Profiling a Confluence server, which has been locally started via the Atlassian SDK, should be straight forward. Start the server, attach the Java VisualVM and you are done. Unfortunately, when trying to instrument the classes deployed to the server for CPU profiling, the following exception is thrown on the console:

Code Block
languagetext
themeRDark
titleFound in Confluence Log / Console
Caused by: java.lang.NoClassDefFoundError: 
  org/netbeans/lib/profiler/server/ProfilerRuntimeCPUFullInstr
Note Box
titleCode snippets with added newlines

Code snippets shown in this article have added newlines for readability.

What seems to tell that a required class is not provided is actually a complaint that the OSGi subsystem has not been configured properly.

Add the following lines to specify a profile with additional system properties to your Maven POM to configure Confluence:

Code Block
languagexml
titlePOM Filefile excerpt (showing only the part with the profile)
<profile>
  <id>profiling</id>
    <build>
      <pluginManagement>
        <plugins>
          <plugin>
            <groupId>com.atlassian.maven.plugins</groupId>
            <artifactId>maven-confluence-plugin</artifactId>
            <version>6.3.21</version>
            <extensions>true</extensions>
            <configuration>
              <systemPropertyVariables>
                <atlassian.org.osgi.framework.bootdelegation>orgbootdelegation>
                  org.netbeans.lib.profiler.*,sun.*,com.sun.*
                </atlassian.org.osgi.framework.bootdelegation>
                <atlassian.org.osgi.framework.system.packages>orgpackages>
                  org.netbeans.lib.profiler.server<server
                </atlassian.org.osgi.framework.system.packages>
            </systemPropertyVariables>
          </configuration>
        </plugin>
      </plugins>
    </pluginManagement>
  </build>
</profile>

...

Code Block
languagetext
themeRDark
titleStart Confluence locally in debug mode with profiling on
atlas-debug -Pprofiling

Then add a configuration via the Java VisualVM's UI to limit instrumentation to classes you want to take execution performance measurements and :

Image Added

Finally start the instrumentation!

Finding the system property names took me some time, so hopefully this blog article shortens the time of searching for others.