You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Bug description
If an application is using the JsonLineMapper but is stuck with using Jackson 2.x, it will break.
Environment
Java 25, Spring Batch 6, H2 database
Steps to reproduce
Create a Java application that has spring-batch-infrastructure as a dependency, typically a spring batch application
Add a jackson-databind v2 dependency
Have a usage of the JsonLineMapper in the application
Execute the application
Exception in thread "main" java.lang.NoClassDefFoundError: tools/jackson/databind/json/JsonMapper
at org.springframework.batch.infrastructure.item.file.mapping.JsonLineMapper.<init>(JsonLineMapper.java:51)
at LineMapperUser.main(LineMapperUser.java:5)
Caused by: java.lang.ClassNotFoundException: tools.jackson.databind.json.JsonMapper
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:580)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:490)
... 2 more
Reproducer project linked hereunder.
Expected behavior
As per the migration guide, a migration to Jackson 3 is recommended but should not be mandatory.
Minimal Complete Reproducible example
Reproducer project:
I’d like to take a look at this issue. I plan to investigate a compatibility fix that keeps JsonLineMapper usable when only Jackson 2 is present, while preserving the Jackson 3 path and adding focused regression coverage.
Both options seemed inappropriate to me. So I upgraded the APIs to use Jackson 3 directly (ie no duplication, with one exception for Jackson2ExecutionContextStringSerializer that is kept in deprecated form). Therefore, if you want to use Jackson 2 with Spring Batch v6, you need a custom mapper as in your suggested workaround (you can get the Jackson 2 - compatible form from 70865c1). The migration guide is not accurate in that regard, so I will update it accordingly.
Activity
[-]https://github.com/spring-projects/spring-batch/issues/1207[/-][+]Unable to use JsonLineMapper with Jackson 2[/+]answndud commentedon Mar 18, 2026
I’d like to take a look at this issue. I plan to investigate a compatibility fix that keeps JsonLineMapper usable when only Jackson 2 is present, while preserving the Jackson 3 path and adding focused regression coverage.
answndud commentedon Mar 18, 2026
I opened a PR with a proposed fix: #5351
fmbenhassine commentedon May 26, 2026
@edeweerd1A When I worked on the Jackson 3 upgrade for v6 (70865c1), I considered two options:
Both options seemed inappropriate to me. So I upgraded the APIs to use Jackson 3 directly (ie no duplication, with one exception for
Jackson2ExecutionContextStringSerializerthat is kept in deprecated form). Therefore, if you want to use Jackson 2 with Spring Batch v6, you need a custom mapper as in your suggested workaround (you can get the Jackson 2 - compatible form from 70865c1). The migration guide is not accurate in that regard, so I will update it accordingly.fmbenhassine commentedon May 28, 2026
Migration guide updated.