Compilation and classloading errors in custom application

Issue

The errors "Unresolved compilation problems", "cannot be resolved to a type", or "Compilation errors" are seen when viewing AEM pages and in the error.log.

For example:

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)

Cause

Here are a few possible causes:

  1. Missing OSGi bundles
  2. Stopped OSGi bundles
  3. Corrupt compiled jsp class files

Resolution

To fix the issue, follow the steps below:

A. Check if bundles are stopped

  1. Go to http://aem-host:port/system/console/bundles and log in as admin.

  2. Sort by bundle Status.

  3. See if there are any bundles in Stopped or Resolved state which shouldn't be.

  4. Start them if they are stopped.  If you don't see any stopped bundles or the ones that are supposed to be stopped, then continue to the next step.  Otherwise test and validate if the problem is solved.

B. Check that the classes are exported to the OSGi Class Loader

  1. Go to http://aem-host:port/system/console/depfinder.

  2. In the text field, enter the fully qualified java class name from the error. For example, in the error above, it is "com.geometrixx.components.page.basepage.BasePage"

  3. Click Find.

  4. If an OSGi bundle shows up as a result, then the class is being exported.  Make sure that the bundle is Active. If it isn't, then start the bundle and test.  Otherwise move on to the next step.

C. Clear the compiled JSP cache

Since the java class is exported and is available to the jsp that threw the error, then we can only suspect that the compiled jsp class files are corrupted.

  1. Go to http://aem-host:port/system/console/slingjsp.

  2. Click Recompile all JSPs.

  3. Test to see if the issue is resolved.  If not, then continue to the next step.

  4. Log in to the server's file system.

  5. Go to the AEM installation folder subdirectory crx-quickstart/launchpad/felix

  6. Search under that folder for _jsp.java files.  On Linux, you can run the command below from the AEM installation folder.

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

    You would get a result similar to this:

    ./crx-quickstart/launchpad/felix/bundle218/data/classes
  7. In the result you can see that bundle218 is the folder for the org.apache.sling.scripting.jsp bundle, in your case the folder has a different number than 218.

  8. Delete the subdirectories under data/classes directory.  For example:

    rm -rf ./crx-quickstart/launchpad/felix/bundle218/data/classes/*
  9. Open your browser to http://aem-host:port/system/console/bundles and restart the bundles org.apache.sling.scripting.jsp and org.apache.sling.commons.fsclassloader​

  10. Now test again and validate to see if the problem is resolved.

If the problem is still not resolved after all the above steps, then contact AEM Customer Care.

 Adobe

Saage abi kiiremini ja hõlpsamalt

Uus kasutaja?

Adobe MAX 2024

Adobe MAX
Loovuse konverents

14.–16. oktoobril Miami Beachis ja veebis

Adobe MAX

Loovuse konverents

14.–16. oktoobril Miami Beachis ja veebis

Adobe MAX 2024

Adobe MAX
Loovuse konverents

14.–16. oktoobril Miami Beachis ja veebis

Adobe MAX

Loovuse konverents

14.–16. oktoobril Miami Beachis ja veebis