Skip to main content


Liferay Portal 7.0 OSGi Overview

Starting with Liferay 7.0 the whole portal will be modularized as OSGi Modules.
OSGi (stands for Open Service Gateway Initiative) is a Java framework for developing and deploying modular software programs and libraries. Each bundle is a tightly coupled, dynamically loadable collection of classes, jars, and configuration files that explicitly declare their external dependencies. It is architectured to develop and deploy  modules in modular (sometimes refered to as Micro Services) application.
There are a lot of benefits of using OSGi and below are some:

  1. Easier to manage dependencies across module or plugin level
  2. Modules can be installed and uninstalled during the running server with no need to bounce the server
  3. Module versioning will help developers to reduce/stop class conflict for individual version of modules
  4. Deployment would be quite easy once you understand the build and deployment process through the blade tool
  5. Service contracts are loosely coupled. This means that services can be publish and consume from the service registry.
  6. It’s very fast due to being small and secure with small package/bundles.
  7. One more interesting thing here is, during development you don’t need to be dependent on Liferay SDK until and unless your module or individual project follows Liferay’s OSGi standards.
  8. In-short, this new framework will provide very good flexibility to the developer for the development and will increase productivity as well.Liferay Portal 7.0 OSGi Overview

You may wonder if/how the old portlet/plugin creation approach works using Liferay 7.
Liferay 7 actually supports both implementations.

  • You can still create the portlet using the approach that you were using with Liferay 6.2 by following JSR-286 standards and creating WAR files for deployment.
  • Also, you can do it in an easier way in Liferay 7. Just simply create a jar file as it follows the module framework architecture. This is the recommended approach in version 7.

There are two key concepts you need to understand: module and component framework
Module is a group of Java classes, other optional resources, and a MANIFEST.MF file, packaged together as into a single JAR file. Liferay 7 uses three modules/bundles.
Modules can have multiple components.
Component is nothing but an implementation of interface(e.g. So here you just need to load components through annotations in the implementation class. These loaded/declared components would be part of modules.

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Follow Us