カスタムアプリケーションでのコンパイルおよびクラスロードエラー

問題点

「未解決のコンパイル問題」、「タイプを解明できない」または「コンパイルエラー」といったエラーは、AEM ページを表示したときに、error.log に表示されます。

例:

31.01.2017 06:50:16.950 *ERROR* [192.150.9.201 [1485805816944] GET /content/geometrixx/en.html HTTP/1.1] org.apache.sling.engine.impl.SlingRequestProcessorImpl service: Uncaught SlingException
java.lang.Error: Unresolved compilation problems: 
    com.geometrixx.components.page.basepage.BasePage cannot be resolved to a type
    com.geometrixx.components.page.basepage.BasePage cannot be resolved to a type
    at org.apache.jsp.apps.geometrixx.components.page.base_002dpage.base_002dpage_jsp._jspService(base_002dpage_jsp.java:194)
    at org.apache.sling.scripting.jsp.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:725)
12.02.2018 12:30:52.565 *ERROR* [10.43.32.15 [1518456652560] GET /mnt/overlay/cq/gui/content/coral/common/form/tagfield/picker.html HTTP/1.1] org.apache.sling.engine.impl.SlingRequestProcessorImpl service: Uncaught SlingException
org.apache.sling.scripting.java.impl.ServletWrapper$CompilerException: Compilation errors in /libs/cq/gui/components/coral/common/form/tagfield/datasources/children/children.java:
Line 72, column 3158 : The method transform(Object) of type new Transformer(){} must override a superclass method
    at org.apache.sling.scripting.java.impl.ServletWrapper$CompilerException.create(ServletWrapper.java:290)
12.02.2018 12:31:23.006 *ERROR* [10.43.32.15 [1518456683001] GET /mnt/overlay/granite/ui/content/coral/foundation/form/pathfield/picker.html HTTP/1.1] org.apache.sling.engine.impl.SlingRequestProcessorImpl service: Uncaught SlingException
org.apache.sling.scripting.java.impl.ServletWrapper$CompilerException: Compilation errors in /libs/granite/ui/components/coral/foundation/form/pathfield/datasources/children/children.java:
Line 114, column 4844 : The method evaluate(Object) of type new Predicate(){} must override a superclass method
Line 132, column 5667 : The method compare(Resource, Resource) of type new Comparator<Resource>(){} must override a superclass method
Line 164, column 6736 : The method transform(Object) of type new Transformer(){} must override a superclass method
Line 191, column 7631 : The method evaluate(Object) of type children.FolderPredicate must override a superclass method
Line 208, column 8089 : The method evaluate(Object) of type children.HierarchyPredicate must override a superclass method
Line 225, column 8553 : The method evaluate(Object) of type children.NoSystemPredicate must override a superclass method
Line 242, column 9064 : The method evaluate(Object) of type children.HierarchyNotFilePredicate must override a superclass method
Line 282, column 10387 : The method transform(Object) of type new Transformer(){} must override a superclass method
    at org.apache.sling.scripting.java.impl.ServletWrapper$CompilerException.create(ServletWrapper.java:290)

原因

考えられる原因は次のとおりです。

  1. OSGi バンドルがありません
  2. OSGi バンドルを停止しました
  3. コンパイルされた jsp クラスファイルの破損

解決策

この問題を解決するには、次の手順に従います。

A. バンドルを停止するかどうかを確認します

  1. http://aem-host:port/system/console/bundles にアクセスして、管理者としてログインしてください。

  2. バンドルステータスでソートする。

  3. あるべき状態ではない停止したまたは解決されたにバンドルがあるかどうかを確認してください。

  4. 停止している場合は、起動します。停止された、或いは停止されることになっているバンドルが表示されていない場合は、次のステップに進みます。それ以外の場合は、問題が解決されているかどうかをテストおよび検証します。

B. クラスが OSGi クラスローダーに書き出されていることを確認

  1. http://aem-host:port/system/console/depfinder にアクセスしてください。

  2. テキストフィールドに、エラーから完全に修飾された java クラスを入力します。例えば、上部のエラーが、「com.geometrixx.components.page.basepage.BasePage」だとします

  3. 検索をクリックしてください。

  4. OSGi バンドルが結果として表示される場合、このクラスは書き出されます。バンドルがアクティブであることを確認します。そうでない場合は、バンドルを開始してテストします。それ以外の場合は、次の手順に進みます。

C. コンパイルされた JSP キャッシュをクリアする

Java クラスは書き出しされ、エラーを返した jsp は利用可能なので、コンパイルされた jsp クラスファイルが壊れていることのみ疑われます。

  1. http://aem-host:port/system/console/slingjsp にアクセスしてください。

  2. すべての JSP を再コンパイルをクリックしてください。

  3. 問題が解決したかどうかをテストします。そうでない場合は、次の手順に進みます。

  4. サーバーのファイルシステムにログインします。

  5. AEM インストールフォルダーサブディレクトリ crx-quickstart/launchpad/felix にアクセスしてください

  6. _jsp.java ファイルのフォルダーを検索します。Linux では、AEM インストールフォルダーから次のコマンドを実行することができます。

    find ./crx-quickstart/launchpad/felix -type d -name classes

    次のような結果が得られます。

    ./crx-quickstart/launchpad/felix/bundle218/data/classes
  7. 結果として、フォルダーに 218 以外の番号がある場合は、bundle218org.apache.sling.scripting.jsp バンドルのフォルダーであることが確認できます。

  8. データ/クラスディレクトリの下のサブディレクトリを削除します。 以下に例を挙げます。

    rm -rf ./crx-quickstart/launchpad/felix/bundle218/data/classes/*
  9. http://aem-host:port/system/console/bundles をブラウザで開き、org.apache.sling.scripting.jsp and org.apache.sling.commons.fsclassloader バンドルを再起動します

  10. 再度テストして、問題が解決したかどうかを確認します。

上記の手順をすべて実行した後も、問題が解決しない場合は、AEM カスタマーケアにお問い合わせください。

アドビのロゴ

アカウントにログイン