When coding on any platform, you can sometimes run into issues that have no clear resolution. This can be particularly frustrating. If you have issues building, deploying, or running apps and modules, you want to resolve them fast. These frequently asked questions and answers help you troubleshoot and correct problems.

Here are the troubleshooting sections:

Click a question to view the answer.


How can I configure dependencies on Liferay artifacts? 

What are optional package imports and how can I specify them? 

When developing modules, you can declare optional package imports. An optional package import is one your module can use if it’s available, but can still function without it. Specifying optional package imports is straightforward.

How can I connect to a JNDI data source from my module? 

Connecting to an application server’s JNDI data sources from Liferay’s OSGi environment is almost the same as connecting to them from the Java EE environment. In an OSGi environment, the only difference is that you must use Liferay Portal’s class loader to load the application server’s JNDI classes.

My module has an unresolved requirement. What can I do? 

If one of your bundles imports a package that no other bundle in the Liferay OSGi runtime exports, Liferay Portal reports an unresolved requirement:

! could not resolve the bundles: …  Unresolved requirement: Import-Package: …  …  Unresolved requirement: Require-Capability …  

To satisfy the requirement, find a module that provides the capability, add it to your build file’s dependencies, and deploy it.

An IllegalContextNameException reports that my bundle’s context name does not follow Bundle-SymbolicName syntax. How can I fix the context name? 

Why doesn’t the package I use from the fragment host resolve? 

The application server and database started, but Liferay Portal failed to connect to the database. What happened and how can I fix this? 

Liferay Portal initialization can fail while attempting to connect to a database server that isn’t ready. Configuring startup to retry JDBC connections facilitates connecting Liferay Portal to databases.

How can I adjust my module’s logging? 

How can I implement logging in my module or plugin? 

Why did the entity sort order change when I migrated to a new database type? 

After creating a relational mapping between Service Builder entities, my portlet is using too much memory. What can I do? 

Services and Components

How can I see what’s happening in the OSGi container? 

How can I detect unresolved OSGi components? 

module components that use Service Builder use Dependency Manager (DM) and most other module components use Declarative Services (DS). Gogo shell commands and tools help you find and inspect unsatisfied component references for DM and DS components.

What is the safest way to call OSGi services from non-OSGi code? 

How can I use files to configure components? 

How can I access OSGi Services from my Ext plugin? 

Resolving Bundle Requirements

If one of your bundles needs a package that is not exported by any other bundle in the Liferay OSGi runtime, you get a bundle exception. Here’s an example exception: ! could not resolve the...

Llegeix més

Resolving Bundle-SymbolicName Syntax Issues

Liferay’s OSGi Runtime framework sometimes throws an IllegalContextNameException. Often, this is because an OSGi bundle’s Bundle-SymbolicName manifest header has a space in it. The...

Llegeix més

Resolving ClassNotFoundException and NoClassDefFoundError in OSGi Bundles

`ClassNotFoundException and NoClassDefFoundError are common, well known exceptions: ClassNotFoundException is thrown when looking up a class that isn’t on the classpath or using an invalid name to...

Llegeix més

Identifying Liferay Artifact Versions for Dependencies

When you’re developing an application using Liferay APIs or tools—for example, you might create a Service Builder application or use Message Bus or Asset Framework—you must determine which versions...

Llegeix més

Connecting to JNDI Data Sources

Connecting to an application server’s JNDI data sources from Liferay Portal’s OSGi environment is almost the same as connecting to them from the Java EE environment. In an OSGi environment, the...

Llegeix més

Adjusting Module Logging

Liferay Portal uses Log4j logging services. Here are the ways to configure logging for module classes and class hierarchies. Log Levels in Liferay Portal’s UI Configure Log4j for multiple modules...

Llegeix més

Implementing Logging

Liferay Portal CE 7.1 uses the Log4j logging framework, but it may be replaced in the future. It’s a best practice to use Simple Logging Facade for Java (SLF4J) to log messages in your modules and...

Llegeix més

Declaring Optional Import Package Requirements

When developing modules, you can declare optional dependencies. An optional dependency is one your module can use if available, but can still function without it. Important: Try to avoid optional...

Llegeix més

Why Aren’t my Module’s JavaScript and CSS Changes Showing?

To determine why JavaScript and CSS updates to your module aren’t having an effect in your browser, perform these checks: If you’re developing a portlet module, check that your portlet class has...

Llegeix més

Why Aren’t JSP overrides I Made Using Fragments Showing?

Important: It’s strongly recommended to customize JSPs using Liferay Portal’s API. Since overriding a JSP using an OSGi fragment is not based on APIs there’s no way to guarantee that it will fail...

Llegeix més

Why doesn’t the package I use from the fragment host resolve?

An OSGi fragment can access all of the fragment host’s packages—it doesn’t need to import them from another bundle. bnd adds external packages the fragment uses (even ones in the fragment host) to...

Llegeix més

Sort Order Changed with a Different Database

If you’ve been using Liferay Portal, but are switching it to use a different database type, consult your database vendor documentation to understand your old and new database’s default query result...

Llegeix més

Disabling Cache for Table Mapper Tables

Service Builder creates relational mappings between entities. It uses mapping tables to associate the entities. In your service.xml file, both entities have a mapping-table column attribute of the...

Llegeix més

Troubleshooting Front-End Development Issues

Front-end development involves many moving parts. Sometimes it’s hard to tell what may be causing the issues you run into along the way. This can be particularly frustrating. These frequently asked...

Llegeix més

System Check

During development, all kinds of strange things can happen in the OSGi container. Liferay’s system:check Gogo shell command can help you see what’s happening. You can enable it to run as the last...

Llegeix més

Detecting Unresolved OSGi Components

Liferay Portal includes Gogo shell commands that come in handy when trying to diagnose a problem due to an unresolved OSGi component. The specific tools to use depend on the component framework of...

Llegeix més

Using Files to Configure Module Components

Liferay Portal uses Felix File Install to monitor file system folders for new/updated configuration files, and the Felix OSGi implementation of Configuration Admin to let you use files to configure...

Llegeix més

Calling Non-OSGi Code that Uses OSGi Services

Liferay Portal’s static service utilities (e.g., UserServiceUtil, CompanyServiceUtil, GroupServiceUtil, etc.) are examples of non-OSGi code that use OSGi services. Service Builder generates them...

Llegeix més

Liferay Portal Failed to Initialize Because the Database Wasn’t Ready

If you start your database server and application server at the same time, Liferay Portal might try connecting to the data source before the database is ready. By default, Liferay Portal doesn’t...

Llegeix més

Using OSGi Services from EXT Plugins

ServiceTrackers are the best way for Ext plugins to access OSGi services. They account for the possibility of OSGi services coming and going. Related Topics Detecting Unresolved OSGi Components...

Llegeix més
0 (0 Vots)
Semantic Versioning Anterior