Skip to main content

Creating OSGi Modules and Sharing Packages

  Overview This guide walks through creating two OSGi modules in Liferay 7.4 and sharing a Java package between them using the standard API + Implementation pattern. This is the most common and correct approach for exposing reusable services in a Liferay-based architecture. In OSGi, a bundle (module) does not expose its internal packages by default — everything is private unless explicitly exported. To share code between modules, the standard practice is to split functionality into: · An API module — contains interfaces/DTOs and exports the package · A Service (Implementation) module — implements the interface, imports the package, and registers the implementation as an OSGi component/service The consuming module then simply imports the API package and looks up the service using @Reference injection. Step 1: Create the API Module Using Liferay Workspace + Blade CLI, generate a new API module: blade create -t api -p com.sgc.greeting greeting-api This generates a Gradle module unde...

Complete Guide to Exporting and Importing Liferay Objects and Client Extensions


Migrating applications between Liferay environments is a common requirement during upgrades, environment refreshes, or production deployments. Whether you're moving custom Objects or Client Extensions, following the correct migration sequence is essential to avoid configuration issues and data inconsistencies.


Exporting and Importing Liferay Objects

Liferay Objects consist of two major components:

  • Object Definition – The schema that defines fields, relationships, validations, actions, and business logic.

  • Object Entries – The actual data stored within the object.

Important: Always migrate the Object Definition first, followed by the Object Entries.

1: Export the Object Definition

The Object Definition contains the complete structure of your object.

Steps

  1. Navigate to:

    Global Menu → Control Panel → Objects

  2. Locate the required Object.

  3. Click the Actions (⋮) menu.

  4. Select Export Object Definition.

Liferay generates a JSON file containing:

  • Object fields

  • Relationships

  • Actions

  • Validations

  • Other object configurations

This JSON serves as the blueprint for recreating the object in another environment.

2: Import the Object Definition

Once the schema has been exported, import it into the target environment.

Steps

  1. Navigate to:

    Global Menu → Control Panel → Objects

  2. Open the folder Actions menu.

  3. Select Import Object Definition.

  4. Upload the exported JSON file.

During import, Liferay uses the External Reference Code (ERC) to recreate the object while maintaining consistency across environments.

3: Export and Import Object Entries

After importing the object definition, migrate the data.

Option 1: Small Datasets

For smaller datasets, use the Data Migration Center.

Navigate to:

Global Menu → Applications → Data Migration Center

From there:

  • Select the required Object.

  • Export data as JSON or CSV.

  • Import the file into the target environment.

This method is simple and suitable for development or testing environments.

Option 2: Large Datasets

For production-sized datasets, Liferay recommends using a Batch Client Extension.

The process involves:

  • Exporting data into a *.batch-engine-data.json file.

  • Packaging it as a Batch Client Extension.

  • Deploying it to the target Liferay instance.

This approach is more scalable and better suited for large volumes of data.


Comments

Popular posts from this blog

service builder with crud operation in liferay

   Crud and Search opration in Liferay:      ->  Liferay use service builder techniq for Crud opration.    ->  Service builder purform by  Service.xml file.    ->  Service.xml file create table in database and also create class and diffrent method.   1)      Create service.xml file.             ->Create service.xml file in WEB-INF and write below code.             ->CODE:        < service-builder package-path = "com.test" >         < namespace > qr </ namespace >           < entity name = "Searchclass" local-service = "true"                     ...

How to create new site programmaticly in liferay with validation

Create site in liferay <%@page import="javax.portlet.PortletPreferences"%> <%@page import="com.liferay.portal.kernel.util.ParamUtil"%> <%@page import="com.liferay.portal.kernel.util.HtmlUtil"%> <%@page import="com.liferay.portal.kernel.util.StringPool"%> <%@page import="com.liferay.portal.kernel.util.UnicodeProperties"%> <%@page import="com.liferay.portal.service.LayoutSetPrototypeServiceUtil"%> <%@page import="com.liferay.portal.model.LayoutSetPrototype"%> <%@page import="com.liferay.portal.service.GroupLocalServiceUtil"%> <%@page import="java.util.List"%> <%@page import="com.liferay.portal.kernel.bean.BeanParamUtil"%> <%@page import="com.liferay.portal.theme.ThemeDisplay"%> <%@page import="com.liferay.portal.model.Group"%> <%@page import="com.liferay.portal.kernel.util.WebK...

The Ultimate Guide to Liferay DXP Performance Tuning: Speed Up Your Portal

The Ultimate Guide to Liferay DXP Performance Tuning: Speed Up Your Portal In the enterprise web space, milliseconds equal millions. Whether you are running a B2B commerce storefront, a customer support portal, or an employee intranet on Liferay DXP, slow load times will devastate your user experience and destroy your SEO rankings. Out of the box, Liferay is configured to run on almost any machine. This means its default settings are highly conservative to ensure compatibility, not maximum performance. If you are launching a production environment without tuning your server, you are leaving massive amounts of speed and scalability on the table. In this comprehensive, deep-dive guide, we are going to explore the critical layers of Liferay performance tuning. We will cover backend Java Virtual Machine (JVM) configuration, Database Connection Pooling, Elasticsearch optimization, and Frontend caching strategies. By the end of this guide, you will have a blazing-fast, enterprise-grade...