Unit test failures after upgrading to AEM SDK 2026.9.28386

✨ This content is AI generated and could be inaccurate. Generative AI Terms

This article explains how to resolve widespread unit test failures in local Maven builds after upgrading to Adobe Experience Manager (AEM) SDK 2026.9.28386, which are caused by changes in core and testing dependencies.

Description description

Environment

  • Adobe Experience Manager (AEM) SDK 2026.9.28386 (upgrade from 2026.8.27830)

Symptoms

  • After upgrading the AEM SDK, local Maven builds fail a large number of unit tests that previously passed.
  • Failures occur primarily during execution of the maven-surefire-plugin:test goal.
  • Errors include:
  • Unexpected exceptions such as java.lang.reflect.InvocationTargetException
  • NoClassDefFoundError, NoSuchMethodError, or NoSuchFieldError
  • Runtime errors initializing JCR Mock resource resolver factory
  • Test failures related to missing or incompatible classes, methods, or fields (e.g., Log4j, Sling Mock, JCR Mock)
  • Unit tests that rely on JCR Mock, Sling Mock, Log4j, or related testing dependencies fail to initialize or throw runtime errors.

Cause

The AEM SDK 2026.9.28386 upgrade introduced changes to core and testing dependencies, resulting in incompatibilities with older versions of JCR Mock, Sling Mock, Log4j, or related libraries used in unit tests.

Resolution resolution

Follow the steps below to resolve the issue.

  1. Review the AEM SDK Release Notes for version 2026.9.28386 for any documented changes to core libraries or testing dependencies.
  2. Update your project’s test dependencies (such as io.wcm.testing.mock.aem, org.apache.sling.testing.sling-mock, and org.apache.logging.log4j) to versions compatible with the upgraded AEM SDK. Refer to the AEM Archetype for recommended versions.
  3. Update the versions of these dependencies in your pom.xml to match or exceed those bundled with the new SDK.
  4. Run mvn clean install -U to clear cached artifacts and rebuild the project with updated dependencies.
  5. Review stack traces for errors such as NoClassDefFoundError, NoSuchMethodError, or NoSuchFieldError and update test code to avoid usage of deprecated or removed APIs. Refactor tests as needed.
  6. Ensure that the Log4j version used in tests is compatible with the SDK and align logging dependencies as necessary.
  7. Re-run unit tests with mvn test to verify that they now pass with the updated dependencies.
recommendation-more-help
experience-cloud-kcs-help-kbarticles