Jahia OSGi architecture

November 14, 2023

In this section of the documentation we present high-level views of the architecture, flows and class loader hierarchies of Jahia OSGi integration.

Architecture overview

Jahia has integrated an OSGi runtime framework developed by the Apache Foundation called Apache Karaf. Apache Karaf actually uses the Apache Felix OSGi implementation but also provides out of the box tooling such as an SSH Command Line interface as well as clustering support (Apache Karaf Cellar) that the basic Apache Felix implementation lacks. Thanks to these integrations module developers benefit from the clean isolation and highly dynamic deployments that this technology offers. Over time, it is expected that more and more parts of the Jahia core code will migrate into modules, therefore expanding the usage of OSGi bundles throughout the application. This process will take some time and will clearly happen over the course of several versions but should not affect module developers significantly as their bundles will already be packaged using OSGi bundles.


Inside the OSGi framework,  all the OSGi bundles are managed by Apache Karaf that bring functionalities such as support of module management in cluster. Other system bundles include the Apache Felix OSGi Web Console and the Apache Karaf SSH Command Line shell, which are two low-level administration tools that are quite useful to access the OSGi internal runtime.

The Jahia administration is implemented using OSGi modules and therefore now also lives inside the OSGi framework.

Request flow

The request flow was modified with the introduction of the OSGi framework to address the following requirements:

  • be able to serve resources directly from an OSGi bundle, compiling JSPs that are located inside bundles and serving images directly from the JAR
  • integrating other OSGi Http services such as the OSGi Web console or custom servlets packaged inside Jahia modules

The graph below shows how the different software components are involved in request processing. Basically on the left side this is the legacy request flow processing before OSGi introduction and in the middle an Http Bridge (Apache Felix Http Bridge) relays the requests through the OSGi Http service to integrate with bundles that register servlets inside the Http Service. The Jahia OSGi extender is a bundle that listens to bundle events and is responsible for registering all the different resources of a bundle into the Http Service. On the right Jahia also exposes another OSGi proxy servlet to expose services such as the Apache Felix OSGi Web Console available at the Jahia http://localhost:8080/tools URL.

Class loader graph

In this section, we illustrate what the class-loading graph looks like in a typical Jahia installation. By default, the server is integrated with the Apache Tomcat servlet container, and the graph below includes the Tomcat class loaders.

As we can see the Jahia Webapp is the main application class loader, but below we see that the graph no longer looks like a tree and OSGI class loaders may access different class loaders depending on their declared dependencies.

If you’re interested in learning more about the Tomcat class loader, you can find the related documentation here: http://tomcat.apache.org/tomcat-7.0-doc/class-loader-howto.html