OSGi configuration is bound to old version of the OSGi bundle

When installing a new version of a custom bundle OSGi, configurations stay bound to the old bundle and are not bound to the new OSGi components.

Environment

AEM 6.2 and earlier versions

Cause

In AEM 6.2 and earlier versions, OSGi configurations were bound to the OSGi component with a matching PID. When you uninstall an older version of a custom bundle but not the associated OSGi configurations, then install a newer version of the bundle. The configurations stay bound to the no longer existing bundle.

Resolution

To avoid this issue, do not uninstall the older version of the OSGi bundle before installing a newer version. Install the newer code package with higher version number over the old one.

Note for later AEM versions

In AEM6.3 and later AEM versions, this issue is avoided. Newer implementations of OSGi Declarative Services do not bind configurations anymore when delivering them to a component. This is to reduce resource consumption and avoid race conditions and is in guidance with the specification. In general, configuration binding is considered legacy from the OSGi specification point of view. In AEM 6.3 and later versions, if you want to know whether your component got a configuration, you can go to the components tab, look at a component and see whether it has a PID.