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 TypeNotPresentException referencing com.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:

  1. Search your codebase for any references to com.fasterxml.jackson.databind.PropertyNamingStrategy$SnakeCaseStrategy.

  2. Replace all usages of PropertyNamingStrategy$SnakeCaseStrategy with PropertyNamingStrategies$SnakeCaseStrategy(note the plural form).

    • Old: com.fasterxml.jackson.databind.PropertyNamingStrategy$SnakeCaseStrategy
    • New: com.fasterxml.jackson.databind.PropertyNamingStrategies$SnakeCaseStrategy
  3. 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.

  4. Ensure that jackson-databind is included with ‘provided’ scope in your build configuration to avoid version conflicts with the platform.

  5. Deploy the updated code to your AEM environment.

  6. Verify that the TypeNotPresentException no longer appears in the logs and that forms are loading as expected.

recommendation-more-help
experience-cloud-kcs-help-kbarticles