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:testgoal. - Errors include:
- Unexpected exceptions such as
java.lang.reflect.InvocationTargetException NoClassDefFoundError,NoSuchMethodError, orNoSuchFieldError- 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.
- Review the AEM SDK Release Notes for version 2026.9.28386 for any documented changes to core libraries or testing dependencies.
- Update your project’s test dependencies (such as
io.wcm.testing.mock.aem,org.apache.sling.testing.sling-mock, andorg.apache.logging.log4j) to versions compatible with the upgraded AEM SDK. Refer to the AEM Archetype for recommended versions. - Update the versions of these dependencies in your
pom.xmlto match or exceed those bundled with the new SDK. - Run
mvn clean install -Uto clear cached artifacts and rebuild the project with updated dependencies. - Review stack traces for errors such as
NoClassDefFoundError,NoSuchMethodError, orNoSuchFieldErrorand update test code to avoid usage of deprecated or removed APIs. Refactor tests as needed. - Ensure that the Log4j version used in tests is compatible with the SDK and align logging dependencies as necessary.
- Re-run unit tests with
mvn testto verify that they now pass with the updated dependencies.
recommendation-more-help
experience-cloud-kcs-help-kbarticles