This article documents how to self-diagnose the structural issues in custom jars. There are different types of structural issues in custom jars, and this is a general guideline for developers to troubleshoot the structural issues during the development.
Resolution
1. Use bnd
Command to Check the Syntax of Module’s Symbolic Name
- Install Liferay Dev Studio installer from Developer Tools > Liferay Project SDK > Latest Release
- Run the following command to check the module's symbolic name and Resolve Bundle-SymbolicName Syntax Issues.
bnd print [path-to-bundle]
For example:
emma$ bnd print bookmark.custom-1.0.0.jar [MANIFEST bookmark.custom-1.0.0] Bnd-LastModified 1518747539446 Bundle-ManifestVersion 2 Bundle-Name bookmark-custom Bundle-SymbolicName bookmark.custom Bundle-Version 1.0.0 Created-By 1.8.0_45 (Oracle Corporation) Fragment-Host com.liferay.bookmarks.web;bundle-version="1.0.15" Import-Package javax.servlet,javax.servlet.http Javac-Debug on Javac-Deprecation off Javac-Encoding Cp1252 Manifest-Version 1.0 Tool Bnd-3.2.0.201605172007 [IMPEXP] Import-Package javax.servlet javax.servlet.http
2. Use the Following GogoShell Commands to Check Status of Bundle and Fragment
lb -s [Bundle-SymbolicName]
lb
- lists all of the bundles installed in DXP's module framework. Use the-s
flag to list the bundles using the bundles’ symbolic names.The output should look like the following:
g! lb -s bookmark.custom START LEVEL 20 ID|State |Level|Symbolic name 753|Resolved | 10|bookmark.custom (1.0.0)
Note: Bundles should be in ACTIVE status and fragments should be in RESOLVED status.
b [BUNDLE_ID]
This lists information about a specific bundle including the bundle’s symbolic name, bundle ID, data root, registered (provided) and used services, imported and exported packages, and more.
The output should look like the following:
g! b 753 bookmark.custom_1.0.0 [753] Id=753, Status=RESOLVED Data Root=/home/emma/Liferay/bundles/dxp/liferay-dxp-digital-enterprise-7.0-sp6/osgi/state/org.eclipse.osgi/753/data "No registered services." No services in use. No exported packages No imported packages Host bundles com.liferay.bookmarks.web_1.0.33 [59]
diag [BUNDLE_ID]
This lists information about why the specified bundle is not working (e.g., unresolved dependencies, etc.)
The output should look like the following:
g! diag 754 com.liferay.portal.search.elasticsearch6.impl [754] Unresolved requirement: Import-Package: com.liferay.portal.search.elasticsearch6.configuration; version="[1.0.0,2.0.0)"
3. Instructions to Detect Unresolved OSGI Components
Troubleshooting Instructions to detect unresolved OSGI components are divided into the following sections:
4. Breaking Changes Detection if the Source Code is Available and You Are in Progress of Upgrade
Additional Information
The following listed items are some frequently asked questions that can help you troubleshoot the issues that may arise based on the underlying OSGi platform. The provided answers will help you to correct the documented issues. Most of these can be found in the Troubleshooting FAQ Page.
- Declaring optional import package requirements
- Resolving classnotfountexception and noclassdefeffounderror in osgi bundles
- Resolving third party library pakate dependencies
- Why aren't JSP overrides I made using fragments showing?
- Why aren't my module's JavaScript and css changes showing?
- Calling non osgi code that uses osgi services
- Using the Wab Generator