Self-Diagnose the Structural Issues in Custom JAR

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.


1. Use bnd Command to Check the Syntax of Module’s Symbolic Name

  1. Install Liferay Dev Studio installer from Developer Tools > Liferay Project SDK > Latest Release
  2. 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-

2. Use the Following GogoShell Commands to Check Status of Bundle and Fragment

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

  2. 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]
  3. 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 [754]
      Unresolved requirement: Import-Package:; 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

  1. DXP 7.0 Breaking Changes
  2. Adapting to Liferay Portal CE 7.0's API with Code Upgrade Tool 

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.

Was this article helpful?
0 out of 0 found this helpful