Resolving Adobe’s Cloud Manager Deployment Issue with Java Version Compatibility

31 / Jul / 2023 by Arpit Varshney 0 comments

Adobe’s Cloud Manager is a popular platform that provides continuous delivery capabilities for code deployments into Adobe Cloud service. However, we encountered a sudden pipeline failure during a recent deployment due to a Java version compatibility issue. In this blog post, we’ll share our experience in diagnosing and resolving this problem, ensuring a smooth deployment.

The Error:

The error message that surfaced during the deployment is as follows:

java.lang.RuntimeException: Unable to initialize JCR_MOCK resource resolver factory: Unable to invoke method ‘activate’ for class org.apache.sling.testing.mock.sling.MockJcrSlingRepositoryCaused by: java.lang.RuntimeException: Unable to invoke method ‘activate’ for class org.apache.sling.testing.mock.sling.MockJcrSlingRepositoryCaused by: java.lang.UnsupportedClassVersionError: org/apache/jackrabbit/api/observation/JackrabbitObservationManager has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0

Investigation and Root Cause:

Upon thorough investigation, we found that the AEM Cloud Manager was set to use Java 8 as the default Java version and certain out-of-the-box classes were not compiled with Java 8, leading to the mentioned exception.

Solution:

To address the compatibility issue and ensure a smooth deployment, we opted to build the Cloud Manager code using Java 11. We explored two approaches to achieve this:

1. Maven Toolchains
One way to select an alternate JDK version for the entire Maven execution process is by using Maven Toolchains. However, we decided not to follow this approach because it would require additional steps to make it work locally, particularly since we were using OpenJDK for local development.

2. Alternate Maven Execution JDK Version
The second approach ensures that you don’t need to change the local vendor for Java 11.

Step 1. [Optional Step] Open the parent pom.xml file, and if you are using the maven-compiler-plugin, update it to use Java 11 as shown below:

Step 2. Create a file named .cloudmanager/java-version at the parent level in the codebase.

Step 3. Open the java-version file and add the value 11 to it.

By implementing this second approach, we ensured that the AEM Cloud Manager was built using Java 11, resolving the Java version compatibility issue during deployment without requiring local configuration changes.

Keeping your technology stack up-to-date is crucial for improving performance and stability. We hope this blog post helps you deal with similar issues and streamline your AEM deployments for optimal results. Happy coding!

References:

FOUND THIS USEFUL? SHARE IT

Leave a Reply

Your email address will not be published. Required fields are marked *