ナレッジベース
公開されました Sep. 10, 2025

トラブルシューティング java.lang.NoClassDefFoundError/java.lang.ClassNotFoundException

written-by

Mariano Alvaro

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.

問題

  • ポータル起動時のみ、java.lang.NoClassDefFoundError または java.lang.ClassNotFoundException が発生します。

環境

  • オプションの依存関係を含むカスタムモジュールを含むポータル。

解決

  1. モジュール内の MANIFEST.MF やソースコード内の bnd.bnd に配置されたものを確認し、クラスを含むパッケージへの依存関係が optionalとして定義されているかどうかを確認します。
  2. optional の修飾子を外した場合の利便性を分析します。

オプションの依存関係は、モジュールが実行時に見つからないクラスを心配することなく安全に開始できることを保証するOSGiの検証をバイパスするので、できるだけ避けるべきです。

追加情報

did-this-article-resolve-your-issue

ナレッジベース