legacy-knowledge-base
公開されました Sep. 10, 2025

Resolving ClassNotFound Exceptions in JSPs and TLDs

written-by

Madeleine Clay

How To articles are not official guidelines or officially supported documentation. They are community-contributed content and may not always reflect the latest updates to Liferay DXP. We welcome your feedback to improve How To articles!

While we make every effort to ensure this Knowledge Base is accurate, it may not always reflect the most recent updates or official guidelines.We appreciate your understanding and encourage you to reach out with any feedback or concerns.

legacy-article

learn-legacy-article-disclaimer-text

Issue

    • A ClassNotFound exception occurs when referencing classes from JSPs or TLDs, even when using a wildcard (*) in the import-package header of liferay-plugin-package.properties.
    • Example error message:
Unable to dispatch request: The class com.example.package.Class specified in the method signature in TLD for the function exampleFunction cannot be found.

Environment

  • Liferay DXP 7.4+

Resolution

  • The wildcard (*) in the import-package header of liferay-plugin-package.properties only imports packages referenced from compiled artifacts. JSPs and TLDs are not compiled during the module build process; they are compiled at runtime by the server. Therefore, the build tool cannot identify their dependencies.
  • To resolve the ClassNotFound exception, explicitly declare the required packages in the import-package header along with the wildcard:
  • Import-Package: com.example.required.package, *
  • This ensures that OSGi can resolve the required class at runtime.

Additional Information

did-this-article-resolve-your-issue

legacy-knowledge-base