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.

Modules

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? 




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...

Read More

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...

Read More

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...

Read More

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...

Read More

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...

Read More

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...

Read More

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...

Read More

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...

Read More

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...

Read More

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...

Read More

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...

Read More

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...

Read More

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...

Read More

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...

Read More

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...

Read More

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...

Read More

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...

Read More

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...

Read More

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...

Read More
0 (0 Votes)
Semantic Versioning Previous