legacy-knowledge-base
公開されました Jul. 2, 2025

サンプルプラグインをデプロイすると、サーバーがシャットダウンしてしまう

written-by

Sivakumar Perumal

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

問題

  • サンプルプラグインをデプロイすると、以下のエラーでサーバーがシャットダウンしてしまいます。
    2019-06-25 12:33:36.955 ERROR [fileinstall-E:/projects/bvip/liferay-dxp/liferay-dxp-7.1.10.2-sp2/osgi/modules][org_apache_felix_fileinstall:97] Error while starting bundle: file:/E:/projects/bvip/liferay-dxp/liferay-dxp-7.1.10.2-sp2/osgi/modules/com.sample.service.jar 
    org.osgi.framework.BundleException: Could not resolve module: com.sample.service [1016]_ Unresolved requirement: Import-Package: com.liferay.portal.kernel.model; version="[1.0.0,2.0.0)"_ [Sanitized]
    at org.eclipse.osgi.container.Module.start(Module.java:444)
    at org.eclipse.osgi.internal.framework.EquinoxBundle.start(EquinoxBundle.java:428)
    at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundle(DirectoryWatcher.java:1258)
    at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundles(DirectoryWatcher.java:1230)
    at org.apache.felix.fileinstall.internal.DirectoryWatcher.doProcess(DirectoryWatcher.java:512)
    at org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:361)
    at org.apache.felix.fileinstall.internal.DirectoryWatcher.run(DirectoryWatcher.java:312)

    2019-06-25 12:33:36.965 ERROR [fileinstall-E:/projects/bvip/liferay-dxp/liferay-dxp-7.1.10.2-sp2/osgi/modules][org_apache_felix_fileinstall:112] Exiting the JVM
    org.osgi.framework.BundleException: Could not resolve module: com.sample.service [1016]_ Unresolved requirement: Import-Package: com.liferay.portal.kernel.model; version="[1.0.0,2.0.0)"_ [Sanitized]
    at org.eclipse.osgi.container.Module.start(Module.java:444)
    at org.eclipse.osgi.internal.framework.EquinoxBundle.start(EquinoxBundle.java:428)
    at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundle(DirectoryWatcher.java:1258)
    at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundles(DirectoryWatcher.java:1230)
    at org.apache.felix.fileinstall.internal.DirectoryWatcher.doProcess(DirectoryWatcher.java:512)
    at org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:361)
    at org.apache.felix.fileinstall.internal.DirectoryWatcher.run(DirectoryWatcher.java:312)
    2019-06-25 12:33:52.828 INFO [Thread-57][ThemeHotDeployListener:171] 1 theme for admin-theme was unregistered
    2019-06-25 12:33:53.354 INFO [Thread-57][ThemeHotDeployListener:171] 1 theme for classic-theme was unregistered
    2019-06-25 12:34:02.352 INFO [Thread-57][PortletHotDeployListener:388] 1 portlet for lcs-portlet was unregistered
    2019-06-25 12:34:02.355 INFO [Thread-57][HookHotDeployListener:569] Hook for lcs-portlet was unregistered

環境

  • Liferay 7.1

解像度

  • 説明します: このクラス com.liferay.portal.equinox.log.bridge.internal.PortalSynchronousLogListener.java によると、 (throwable != null), (throwable instanceof BundleException) and (_JENKINS_HOME != null) という三つの条件をすべて満たすとサーバがメッセージをスローする。
    if ((throwable != null) && (throwable instanceof BundleException) &&
    (_JENKINS_HOME != null)) {

    String throwableMessage = throwable.getMessage();
    もし、そのthrowableメッセージが "Could not resolve module "で始まっていれば、以下の条件が成立し、さらに先に進むことになります。 System.exit(1)のため、JVMが終了し、サーバーのシャットダウンが開始されます。
    if (throwableMessage.startsWith("Could not resolve module"))
    {
    log.error(_FORMAT, "Exiting the JVM", context, throwable);
    System.exit(1);
    }
    }
    これはLiferayの意図した動作で、つまり、上記の条件が真になったときにJVMが終了するのです。
  • 解決方法 com.liferay.portal.kernel.model パッケージのバージョンが見つからないため、以下のエラーが発生するのを防ぐため、サンプルプラグインは必要なインポートパッケージと一緒に含める必要があります。 これを解決することで、上記の状態を回避することができ、サーバーがシャットダウンすることはありません。
    org.osgi.framework.BundleException: Could not resolve module: com.sample.api [1015]_ Unresolved requirement: Import-Package: com.liferay.portal.kernel.model; version="[1.0.0,1.1.0)"_ [Sanitized] 

追加情報

  • 回避策として、システムの環境変数からJENKINS_HOMEを削除することで、上記動作は解消されます。
did-this-article-resolve-your-issue

legacy-knowledge-base