{"id":57859,"date":"2023-07-31T23:10:22","date_gmt":"2023-07-31T17:40:22","guid":{"rendered":"https:\/\/www.tothenew.com\/blog\/?p=57859"},"modified":"2024-06-10T15:38:11","modified_gmt":"2024-06-10T10:08:11","slug":"resolving-adobes-cloud-manager-deployment-issue-with-java-version-compatibility","status":"publish","type":"post","link":"https:\/\/www.tothenew.com\/blog\/resolving-adobes-cloud-manager-deployment-issue-with-java-version-compatibility\/","title":{"rendered":"Resolving Adobe\u2019s Cloud Manager Deployment Issue with Java Version Compatibility"},"content":{"rendered":"<p><span style=\"font-weight: 400;\">Adobe&#8217;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&#8217;ll share our experience in diagnosing and resolving this problem, ensuring a smooth deployment.<\/span><\/p>\n<h2><span style=\"font-weight: 400;\">The Error:<\/span><\/h2>\n<p><span style=\"font-weight: 400;\">The error message that surfaced during the deployment is as follows:<\/span><\/p>\n<p><em><strong>java.lang.RuntimeException: Unable to initialize JCR_MOCK resource resolver factory: Unable to invoke method &#8216;activate&#8217; for class org.apache.sling.testing.mock.sling.MockJcrSlingRepositoryCaused by: java.lang.RuntimeException: Unable to invoke method &#8216;activate&#8217; 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<\/strong><\/em><\/p>\n<h2><span style=\"font-weight: 400;\">Investigation and Root Cause:<\/span><\/h2>\n<p><span style=\"font-weight: 400;\">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.<\/span><\/p>\n<h2><span style=\"font-weight: 400;\">Solution:<\/span><\/h2>\n<p><span style=\"font-weight: 400;\">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:<\/span><\/p>\n<p>1. <a href=\"https:\/\/experienceleague.adobe.com\/docs\/experience-manager-cloud-manager\/content\/getting-started\/project-creation\/build-environment.html?lang=en#maven-toolchains\"><span style=\"font-weight: 400;\">Maven Toolchains<\/span><span style=\"font-weight: 400;\"><br \/>\n<\/span><\/a><span style=\"font-weight: 400;\">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.<\/span><\/p>\n<p>2. <a style=\"font-size: 1rem;\" href=\"https:\/\/experienceleague.adobe.com\/docs\/experience-manager-cloud-manager\/content\/getting-started\/project-creation\/build-environment.html?lang=en#alternate-maven\">Alternate Maven Execution JDK Version<\/a><br \/>\nThe second approach ensures that you don&#8217;t need to change the local vendor for Java 11.<\/p>\n<p><strong>Step 1<\/strong>. <span style=\"font-weight: 400;\"><span style=\"font-weight: 400;\"><span style=\"font-weight: 400;\"><span style=\"font-weight: 400;\"><strong>[Optional Step]<\/strong> Open the parent pom.xml file, and if you are using the maven-compiler-plugin, update it to use Java 11 as shown below:<br \/>\n<\/span><\/span><\/span><\/span><\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone wp-image-57856\" src=\"\/blog\/wp-ttn-blog\/uploads\/2023\/07\/Screenshot-2023-07-31-at-8.57.36-PM-copy.png\" alt=\"\" width=\"653\" height=\"443\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2023\/07\/Screenshot-2023-07-31-at-8.57.36-PM-copy.png 900w, \/blog\/wp-ttn-blog\/uploads\/2023\/07\/Screenshot-2023-07-31-at-8.57.36-PM-copy-300x203.png 300w, \/blog\/wp-ttn-blog\/uploads\/2023\/07\/Screenshot-2023-07-31-at-8.57.36-PM-copy-768x521.png 768w, \/blog\/wp-ttn-blog\/uploads\/2023\/07\/Screenshot-2023-07-31-at-8.57.36-PM-copy-624x423.png 624w\" sizes=\"(max-width: 653px) 100vw, 653px\" \/><\/p>\n<p><strong>Step 2<\/strong>. Create a file named <strong>.cloudmanager\/java-version<\/strong> at the parent level in the codebase.<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone wp-image-57857\" src=\"\/blog\/wp-ttn-blog\/uploads\/2023\/07\/Screenshot-2023-07-31-at-8.52.18-PM.png\" alt=\"\" width=\"528\" height=\"751\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2023\/07\/Screenshot-2023-07-31-at-8.52.18-PM.png 758w, \/blog\/wp-ttn-blog\/uploads\/2023\/07\/Screenshot-2023-07-31-at-8.52.18-PM-211x300.png 211w, \/blog\/wp-ttn-blog\/uploads\/2023\/07\/Screenshot-2023-07-31-at-8.52.18-PM-720x1024.png 720w, \/blog\/wp-ttn-blog\/uploads\/2023\/07\/Screenshot-2023-07-31-at-8.52.18-PM-624x887.png 624w\" sizes=\"(max-width: 528px) 100vw, 528px\" \/><\/p>\n<p><strong>Step 3.<\/strong> Open the java-version file and add the value 11 to it.<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone wp-image-57858\" src=\"\/blog\/wp-ttn-blog\/uploads\/2023\/07\/Screenshot-2023-07-31-at-8.56.01-PM.png\" alt=\"\" width=\"525\" height=\"508\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2023\/07\/Screenshot-2023-07-31-at-8.56.01-PM.png 1244w, \/blog\/wp-ttn-blog\/uploads\/2023\/07\/Screenshot-2023-07-31-at-8.56.01-PM-300x290.png 300w, \/blog\/wp-ttn-blog\/uploads\/2023\/07\/Screenshot-2023-07-31-at-8.56.01-PM-1024x989.png 1024w, \/blog\/wp-ttn-blog\/uploads\/2023\/07\/Screenshot-2023-07-31-at-8.56.01-PM-768x742.png 768w, \/blog\/wp-ttn-blog\/uploads\/2023\/07\/Screenshot-2023-07-31-at-8.56.01-PM-624x603.png 624w, \/blog\/wp-ttn-blog\/uploads\/2023\/07\/Screenshot-2023-07-31-at-8.56.01-PM-24x24.png 24w\" sizes=\"(max-width: 525px) 100vw, 525px\" \/><\/p>\n<p>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.<\/p>\n<p>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!<\/p>\n<h2>References:<\/h2>\n<ul>\n<li><a href=\"https:\/\/experienceleague.adobe.com\/docs\/experience-manager-cloud-manager\/content\/getting-started\/project-creation\/build-environment.html?lang=en#alternate-maven\"><span style=\"font-weight: 400;\">https:\/\/experienceleague.adobe.com\/docs\/experience-manager-cloud-manager\/content\/getting-started\/project-creation\/build-environment.html?lang=en#alternate-maven<\/span><\/a><\/li>\n<li><span style=\"font-weight: 400;\"><a href=\"https:\/\/experienceleaguecommunities.adobe.com\/t5\/adobe-experience-manager\/maven-compile-error-on-aemaacs-2023-07\/td-p\/608611\">https:\/\/experienceleaguecommunities.adobe.com\/t5\/adobe-experience-manager\/maven-compile-error-on-aemaacs-2023-07\/td-p\/608611<\/a><br \/>\n<\/span><\/li>\n<\/ul>\n<div class=\"ap-custom-wrapper\"><\/div><!--ap-custom-wrapper-->","protected":false},"excerpt":{"rendered":"<p>Adobe&#8217;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&#8217;ll share our experience in diagnosing and resolving this problem, ensuring a smooth deployment. [&hellip;]<\/p>\n","protected":false},"author":1362,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"iawp_total_views":249},"categories":[5868],"tags":[5311,5313,5314,5062,4847,5315],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/57859"}],"collection":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/users\/1362"}],"replies":[{"embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/comments?post=57859"}],"version-history":[{"count":12,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/57859\/revisions"}],"predecessor-version":[{"id":57953,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/57859\/revisions\/57953"}],"wp:attachment":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/media?parent=57859"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/categories?post=57859"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/tags?post=57859"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}