Resolving deserialization failures after jackson-databind upgrade
This article explains how to resolve deserialization failures in AEM Sites forms that occur after upgrading jackson-databind, specifically when the removed PropertyNamingStrategy$SnakeCaseStrategy class is referenced.
Description description
Environment
- Adobe Experience Manager (AEM) Sites
- jackson-databind version 2.20 or later
Issue/Symptoms
- Errors occur when loading forms in AEM Sites.
- The error message includes
TypeNotPresentExceptionreferencingcom.fasterxml.jackson.databind.PropertyNamingStrategy$SnakeCaseStrategy. - Servlet endpoints using Jackson for JSON deserialization fail at runtime if they reference the removed class.
Cause
The PropertyNamingStrategy$SnakeCaseStrategy class was deprecated in jackson-databind 2.12 and removed in 2.20. Any code referencing this class will fail after upgrading to jackson-databind 2.20 or later.
Resolution resolution
To resolve AEM Sites form deserialization error caused by the removal of PropertyNamingStrategy$SnakeCaseStrategy, follow these steps:
-
Search your codebase for any references to
com.fasterxml.jackson.databind.PropertyNamingStrategy$SnakeCaseStrategy. -
Replace all usages of
PropertyNamingStrategy$SnakeCaseStrategywithPropertyNamingStrategies$SnakeCaseStrategy(note the plural form).- Old:
com.fasterxml.jackson.databind.PropertyNamingStrategy$SnakeCaseStrategy - New:
com.fasterxml.jackson.databind.PropertyNamingStrategies$SnakeCaseStrategy
- Old:
-
Review your codebase for any other deprecated or removed constants or classes from jackson-databind 2.20 and later, and update them to their supported equivalents.
-
Ensure that jackson-databind is included with ‘provided’ scope in your build configuration to avoid version conflicts with the platform.
-
Deploy the updated code to your AEM environment.
-
Verify that the
TypeNotPresentExceptionno longer appears in the logs and that forms are loading as expected.