JDK 11 causes NoClassDefFoundError | AEM 6.5

JDK 11 causes NoClassDefFoundError AEM 6.5

Issue

The error below is observed in the logs after upgrading to Java 11 with AEM 6.5.x.

15.09.2020 00:30:20.868 *ERROR* [FelixStartLevel] org.apache.sling.scripting.sightly bundle org.apache.sling.scripting.sightly:1.1.2.1_4_0 (557)[org.apache.sling.scripting.sightly.impl.engine.extension.use.JavaUseProvider(3410)] :  Error during instantiation of the implementation object (java.lang.NoClassDefFoundError: jdk/internal/reflect/ConstructorAccessorImpl) 
java.lang.NoClassDefFoundError: jdk/internal/reflect/ConstructorAccessorImpl 
 at java.base/jdk.internal.misc.Unsafe.defineClass0(Native Method) 
 at java.base/jdk.internal.misc.Unsafe.defineClass(Unsafe.java:1192) 
 at java.base/jdk.internal.reflect.ClassDefiner.defineClass(ClassDefiner.java:63) 
 at java.base/jdk.internal.reflect.MethodAccessorGenerator$1.run(MethodAccessorGenerator.java:400) 
 at java.base/jdk.internal.reflect.MethodAccessorGenerator$1.run(MethodAccessorGenerator.java:394) 
 at java.base/java.security.AccessController.doPrivileged(Native Method) 
... 
Caused by: java.lang.ClassNotFoundException: Unable to load class 'jdk.internal.reflect.ConstructorAccessorImpl' 
 at org.apache.felix.framework.BundleWiringImpl$1.loadClass(BundleWiringImpl.java:91) 
 at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521) 
 at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1463) 
 at org.apache.felix.framework.BundleWiringImpl.access$300(BundleWiringImpl.java:79) 
 at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:1982) 
 at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521) 
 ... 111 common frames omitted 

Solution

This issue is due to the fact that CXF packages have been removed from AEM and you have to install those externally.

  1. Stop AEM
  2. Find and open this file in a text editor: crx-quickstart/conf/sling.properties
  3. Modify this line:

Before:

org.osgi.framework.bootdelegation=com.yourkit.*, ${org.apache.sling.launcher.bootdelegation}

After:

org.osgi.framework.bootdelegation=sun.*,com.sun.*,jdk.internal.reflect,jdk.internal.reflect.*,com.yourkit.*,${org.apache.sling.launcher.bootdelegation}

4. Start AEM

הערה:

See here for technical details on this issue.

לוגו של Adobe

כניסה לחשבון