AEM OSGI Configuration and Implementation

The aim of this tutorial is to understand, How OSGi is configured in AEM . This is also a follow up question in many aem interviews that how osgi dependencies gets resolved , where osgi configurations are stored in aem.

In the starting, i too had curiosity to know, how osgi services interact with each other and how aem used osgi framework. Below i tried to provide a brief description about AEM OSGI configuration and Implementation.

After completing this tutorial. you will have a clear understanding of:-

OSGI Framework Basics and Implementation in AEM:

OSGI also known as Open Service Gateway Initiative is built on the concept on bundles. Each Bundle has its own class loader. Which allows developers to start and stop each bundle separately.

The OSGI Framework consists of three major parts:- Bundles, Lifecycle, and Services.

  • Services layer exposes services objects that can be called from other services running in the OSGi server.
  • Life-cycle layer defines sequence of steps that the bundles should go through when installed, started, updated, stopped and uninstalled.
  • The Bundle layer is represented as a JAR file.

osgi-implementation-in-aem

Now the question arises how the classes in bundle communicates with each other.

How Dependency is resolved in OSGI Bundle :

Each bundle has two parts component and its associated service. Services communicate with each other to access different components as shown in below diagram.

osgi bundle interaction in aem

In Above example Class A of Bundle A has dependency on Class B & C of Bundle B & C , Now OSGI will export Class B & Class C and import them into Bundle A to resolve dependency.

How OSGI Bundles are Stored in AEM

All the bundles that we create in OSGI , can be found under <cq-quickstart folder>/launchpad/felix

aem 6 osgi felix bundle location


When you click on any bundle, then you can see that each bundle is stored based on their versions.

aem 6 osgi felix bundle version location

When any bundle reaches to a maximum size, then it is zipped down to a tar file which can be found under <cq-quickstart folder>/repository/segmentstore.

aem 6 osgi tar file location

Note:- Tar file contains your data,bundles,versions and work-space backup.

Where OSGI Bundles are Stored in AEM

All the OSGI configurations are stored under  (/apps/sling/config or /apps/system/config) by default. The configuration will be saved as a paragraph property jcr:data in binary(non-readable format) on respective node.
aem 6 osgi configuration location crxde

You can also view same configuration from Felix console http://localhost:4502/system/console/configMgr.

Spread the love
  •  
  •  
  •  
  •  
  •  
  •  

Leave a Reply

Your email address will not be published. Required fields are marked *