Digital Experience Manager OSGi Implementation

  Written by The Jahia Team
   Estimated reading time:

OSGi Framework startup

The OSGi framework is started once DX spring context is instantiated. In turn, FrameworkService initializes Karaf instance which registers all the bundles that will initially be started and made available to all deployed bundles. Of particular note, FrameworkService loads its configuration from the file which contains important settings such as which packages are made available to all bundles.

OSGi Servlet Bridge

The OSGi servlet bridge consists of two parts, a proxy servlet that is mapped as a servlet in the WEB-INF/web.xml file of the Digital Experience Manager web application and then the actual bridge that will make it possible to call “regular” servlet inside the OSGi framework.

Digital Experience Manager Module Extender

The core of the module integration is in the jahia/bundles/jahiamodule-extender project. Here the Activator class is the starting point, that registers the bundle listeners to listen for the deployment and undeployment of bundles and does all the registration work inside Digital Experience Manager. This is where most of the OSGi “magic” is happening, including the registration and dispatching to JSPs.

Bundle packaging

We can have both system bundles that will be handled by Karaf (such as Karaf extensions) and DX bundles (common DX modules).

We are relaying on Karaf for system bundle. All the system bundles are in the Karaf folder, by default located in digital-factory-data/karaf. From here you can use all the Karaf framework to deploy any bundle / feature / kar file. See more information here:

DX has a also watched directory located in digital-factory-data/modules that contains all dx installed bundles

OSGi and Digital Experience Manager Module States

Bundle life cycle

With the installation of a bundle in the OSGi runtime the bundle is persisted in a local bundle cache. The OSGi runtime then tries to resolve all dependencies of the bundle.

If all required dependencies are resolved, the bundle is in the RESOLVED status otherwise it is in the INSTALLED status.

If several bundles exist which would satisfy the dependency, then the bundle with the highest version is used. If the versions are the same, then the bundle with the lowest install ID will be used (the bundle gets a unique identifier assigned by the framework during the installation). If the bundle is started, its status is STARTING. Afterwards it gets the ACTIVE status.


This life cycle is depicted in the following graphic:


Digital Experience Manager extends the default OSGi lifecycle states to add intermediary states that detail the state in which a module is. You can find the description of these states in the following table.

State name OSGi DXM Description
UNINSTALLED x   Bundle is not installed
UNRESOLVED x   Bundle is installed, but dependencies haven’t been resolved
RESOLVED x   Bundle is installed and all dependencies have been resolved
WAITING_TO_BE_PARSED   x Bundle is started but it depends on other Jahia modules for content definitions
PARSED   x Bundle is started and all its content definitions have been parsed
INSTALLED x   Bundle was installed, but not started
UPDATED x   Bundle was updated
STOPPED x   Bundle was stopped
STOPPING x   Bundle is stopping
STARTING x   Bundle is starting
WAITING_TO_BE_STARTED   x Bundle is waiting to be started, waiting for another module to be started
WAITING_TO_BE_IMPORTED   x Bundle is waiting to import its content, waiting for a dependency to import its content
ERROR_DURING_START   x An error occurred during Jahia module start
STARTED x   Bundle is fully started and available
ERROR_WITH_DEFINITIONS   x Bundle cannot start due to definitions error
SPRING_STARTING   x Bundle is started but is wainting for spring context to be available