How to resolve OSGi bundle startup NoClassDefFoundError errors using boot delegation?

How to resolve OSGi bundle startup NoClassDefFoundError errors using boot delegation?

Problem

OSGi bundles or plugins may fail to resolve or start, affecting application startup. The following errors may be displayed in the terminal output or application error logs:

"java.lang.NoClassDefFoundError: com/manageengine/apminsight/agent/JavaAgent"
A ClassNotFoundException for any com.manageengine.* class is the same issue.

Cause

OSGi bundles run in isolated class loaders and may not be able to access JVM-internal packages or externally injected classes, such as those provided by monitoring agents, unless the required packages are explicitly boot-delegated to the parent class loader.

When boot delegation is not configured or is configured incorrectly, the OSGi framework cannot access the APM Insight Java agent classes because the agent package is not included in the boot delegation configuration. This causes the OSGi bundle or plugin to fail to resolve or start.

Solution

Add the APM Insight Java agent package, com.manageengine.*, to the existing boot delegation Java property.

For example:
Info
-Dorg.osgi.framework.bootdelegation=com.sun.*,com.manageengine.*
Alert
Append com.manageengine.* to the existing boot delegation values. Do not remove the existing values.
Platform-specific configuration

Platform-specific configuration

The platform-specific properties and configuration locations are listed in the source document.

Platform
Property
Configuration location
Liferay DXP
module.framework.properties.org.osgi.framework.bootdelegation
portal-ext.properties
Atlassian Jira/Confluence
-Datlassian.org.osgi.framework.bootdelegation.extra
setenv.sh
Adobe Experience Manager (Sling)
-Dorg.osgi.framework.bootdelegation
sling.properties
Other OSGi platforms/bundled applications
-Dorg.osgi.framework.bootdelegation
Startup script, existing JAVA_OPTS, or another location where Java properties are maintained

Restart the application

After adding the com.manageengine.* package to the appropriate boot delegation property, restart the application server for the changes to take effect.

Summary

If an OSGi-based application fails to start with a NoClassDefFoundError or ClassNotFoundException error message for an APM Insight Java agent class, verify that com.manageengine.* has been added to the platform’s existing boot delegation configuration.


                    New to ADSelfService Plus?

                      • Related Articles

                      • Adding APM Insight Java agent in a Kubernetes environment

                        There are three methods for installing the APM Insight Java agent in a Kubernetes environment: Using Dockerfile Using InitContainers Using Persistent Volumes Prerequisites Download the latest APM Insight Java agent ZIP file. Extract the ZIP file and ...
                      • APM Insight Java Agent – Onboarding & Troubleshooting Guide

                        This guide helps support engineers troubleshoot cases where the APM Insight Java Agent is not onboarding (not appearing in Applications Manager) after installation. Follow the step-by-step verification checklist in Section 2 to quickly diagnose and ...
                      • Troubleshoot - Duplicate APMInsight Monitors

                        Introduction: Duplicate monitors might be created in APMInsight due to various reasons. This article will help you identify and resolve the issue of duplicate monitors. The common causes include: - Changes in monitor configuration. (apminsight.conf ...
                      • Self monitor Applications Manager using APM Insight Java Agent

                        Applications Manager is built with Java, hence we can monitor it using APM Insight Java Agent to measure it's performance continuously, which can be very much useful. Setting up APM Insight Java Agent Follow the below steps to download and set up the ...
                      • How to add an APM Insight Java agent in Kubernetes via InitContainers?

                        Step 1. Create a secret to access the APM Insight license key in your application namespace: kubectl create secret generic app-secret --from-literal=s247licensekey='your_APMInsight_license_key' -n petclinic The license key can be obtained from the ...