Skip to content

CAMEL-22857 Convert camel to Jackson 3 - use jackson 3 in all camel components, use camel-jackson3 over camel-jackson#21800

Open
cunningt wants to merge 3 commits intoapache:mainfrom
cunningt:jackson3upgrade
Open

CAMEL-22857 Convert camel to Jackson 3 - use jackson 3 in all camel components, use camel-jackson3 over camel-jackson#21800
cunningt wants to merge 3 commits intoapache:mainfrom
cunningt:jackson3upgrade

Conversation

@cunningt
Copy link
Contributor

@cunningt cunningt commented Mar 7, 2026

Description

  • convert camel to Jackson 3 (com.fasterxml.jackson -> tools.jackson, API changes)
  • all components that used camel-jackson now use camel-jackson3
  • import the tools.jackson:jackson-bom instead of the com.fasterxml.jackson:jackson bom in parent/pom.xml
  • update ObjectMapper references for immutability changes
  • drop wizard metrics upgraded to 4.2.38 to support Jackson 3
  • networknt-json-schema-validator upgrade from 1.5.9 -> 3.0.0 along with API changes (in order to support Jackson 3) -
  • jsonschema-generator upgrade to 5.0.0
  • flowable upgrade to 8.0.0 (in order to support Jackson 3)
  • jackson-annotations does not change groupId/package (jackson 2 annotations supports both Jackson 2 and Jackson 3, introduced a property for jackson2-annotations-version)

There are five components that cannot upgrade to Jackson 3. They are still using Jackson 2 but since Jackson 2 and Jackson 3 maintain different package names there do not seem to be any issues with them staying on Jackson 2 temporarily

  • camel-openapi (open PR for Jackson 3 support for swagger, will upgrade it to Jackson 3 when PR is merged and released)
  • camel-opensearch (open PR for Jackson 3 support for opensearch, will upgrade it when PR is merged and released)
  • camel-jslt (open PR for Jackson 3 support for jslt, will upgrade it when PR is merged and released)
  • camel-json-patch (Jackson 3 not supported yet, project seems abandoned, camel-json-patch deprecated, will not try to upgrade before removal)
  • camel-torchserve (Jackson 3 not supported yet, camel-torchserve is deprecated, will not try to upgrade before removal)

Target

  • I checked that the commit is targeting the correct branch (Camel 4 uses the main branch)

Tracking

  • If this is a large change, bug fix, or code improvement, I checked there is a JIRA issue filed for the change (usually before you start working on it).

Apache Camel coding standards and style

  • [x ] I checked that each commit in the pull request has a meaningful subject line and body.

  • [x ] I have run mvn clean install -DskipTests locally from root folder and I have committed all auto-generated changes.

@github-actions
Copy link
Contributor

github-actions bot commented Mar 7, 2026

🌟 Thank you for your contribution to the Apache Camel project! 🌟
🤖 CI automation will test this PR automatically.

🐫 Apache Camel Committers, please review the following items:

  • First-time contributors require MANUAL approval for the GitHub Actions to run
  • You can use the command /component-test (camel-)component-name1 (camel-)component-name2.. to request a test from the test bot although they are normally detected and executed by CI.
  • You can label PRs using build-all, build-dependents, skip-tests and test-dependents to fine-tune the checks executed by this PR.
  • Build and test logs are available in the summary page. Only Apache Camel committers have access to the summary.

⚠️ Be careful when sharing logs. Review their contents before sharing them publicly.

@jamesnetherton
Copy link
Contributor

Are we planning to do this for 4.19? There wont be any Jackson 3 support in Quarkus until 4.x is released later this year.

Copy link
Contributor

@gnodet gnodet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In-depth Review of Jackson 3 Migration

Overall this is a thorough and well-executed migration across 500+ files. The import renames, API changes (e.g., JsonSerializerValueSerializer, fields()properties(), etc.), and ObjectMapper immutability patterns are generally handled well. CI passes on both JDK 21 and JDK 25.

Bugs Found

1. CBORDataFormat: prettyPrint rebuild result discarded

In components/camel-cbor/src/main/java/org/apache/camel/component/cbor/CBORDataFormat.java, the prettyPrint block does:

objectMapper.rebuild()
        .enable(SerializationFeature.INDENT_OUTPUT)
        .build();

The result of .build() is not assigned back to objectMapper, so INDENT_OUTPUT is silently lost. Compare with the enableFeatures/disableFeatures blocks in the same file which correctly do objectMapper = objectMapper.rebuild()...build().

2. ObjectMapperHelper (LevelDB): customModule registration discarded

In components/camel-leveldb/src/main/java/.../ObjectMapperHelper.java:

if (customModule != null) {
    objectMapper.rebuild().addModule(customModule);
}
return objectMapper;

Two issues: (a) .build() is never called, and (b) the result is never assigned back. The custom module is completely ignored. Should be:

if (customModule != null) {
    objectMapper = objectMapper.rebuild().addModule(customModule).build();
}

Concerns

3. Inconsistent asText() vs asString() usage

In Jackson 3, JsonNode.asText() was renamed to asString(). The PR mixes both:

  • DefaultJsonUriSchemaLoader.java uses node.get("$schema").asText() (Jackson 2 name)
  • AsNestedPropertyDeserializer.java uses node.asText() (Jackson 2 name)
  • YamlTestSupport.groovy uses SCHEMA_NODE.get('$schema').asString() (Jackson 3 name)

While asText() may still work as a deprecated alias, the PR should be consistent and use asString() everywhere.

4. Unused properties in parent POM

Two new properties appear unused:

  • nitrite-version (3.4.4) — no nitrite files changed in this PR
  • jackson-datatype-version (3.0.0-rc2) — not referenced by any ${jackson-datatype-version}

5. Alpha dependency: jackson-jq

jackson-jq-version is set to 2.0.0-alpha1. If the alpha API changes before GA, it could break the build.

6. Public API change (intentional but needs documentation)

Multiple components now expose tools.jackson.databind.ObjectMapper instead of com.fasterxml.jackson.databind.ObjectMapper in their public APIs (json-validator, salesforce, servicenow, ocsf). This is binary-incompatible. Should be documented in the migration guide/release notes.

Positive Observations

  • Import migration is thorough — no stale com.fasterxml.jackson references in new code
  • JavaTimeModule removals are correct (Jackson 3 has built-in java.time support)
  • Velocity templates for Salesforce code generation properly handle the annotation package split
  • networknt json-schema-validator migration (1.5.9 → 3.0.0) is done comprehensively
  • Jackson 2 coexistence for remaining components (camel-opensearch, camel-jslt) is correctly handled with version pinning

@cunningt
Copy link
Contributor Author

cunningt commented Mar 9, 2026

Fixed 1-4.

5. Alpha dependency: jackson-jq

jackson-jq-version is set to 2.0.0-alpha1. If the alpha API changes before GA, it could break the build.

Double checked jackson-jq and 2.0.0-alpha1 is still the only 2.0.0 release. The 2.0.0 milestone is necessary because it provides Jackson 3 support.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants