Lombok 1.18.0 and Jackson 2.9.6 not working together
Interview Questions practice on Codemia
Over 8,000 real interview questions from top companies, searchable by company and role.
Introduction
When Lombok 1.18.0 and Jackson 2.9.6 appear to "stop working together," the failure is usually not that the libraries are incompatible at a binary level. The real problem is that Jackson can no longer infer how to construct a class once Lombok-generated constructors and metadata stop matching what Jackson expects during deserialization.
Why Deserialization Starts Failing
Jackson needs a clear way to create an object from JSON. It can do that through:
- A no-args constructor plus setters
- An explicitly annotated constructor
- A builder configuration Jackson understands
- Constructor parameter names that are preserved and discoverable
Lombok changes what code is generated at compile time. Around Lombok 1.18.0, many teams ran into issues because Jackson could no longer infer constructor parameter names from the generated code path they were relying on before.
A typical failure looks like this:
Serializing this class works fine. Deserializing it often fails, because Jackson sees an all-args constructor but does not know which JSON fields map to which constructor arguments unless extra metadata is available.
The Most Reliable Fix
The safest fix is to make object creation explicit with @JsonCreator and @JsonProperty.
With this version, Jackson no longer needs to guess. The JSON contract is written directly into the constructor signature.
Other Fixes That Often Work
If you want to keep Lombok-generated constructors, you still need to give Jackson enough metadata.
One option is compiling with Java parameter metadata:
Another option is asking Lombok to add constructor-property metadata again:
Place that in lombok.config so the generated constructor exposes names in a form Jackson can consume more reliably.
For mutable DTOs, a simpler workaround is using a no-args constructor and setters:
That is less elegant for immutable models, but it removes the constructor-parameter discovery problem entirely.
Builder Cases Need Extra Care
Another common trap is combining Lombok builders with Jackson and assuming Jackson will automatically use them for deserialization. It usually will not. If your model uses @Builder, you need builder-specific Jackson configuration or an explicit creator method.
A modern codebase may use Lombok's later @Jacksonized support, but that feature is outside the original 1.18.0 and 2.9.6 pairing. For the version combination in this article, explicit annotations are the safer approach.
How to Debug the Exact Failure
Check the exception text carefully. Messages like these point to creator configuration issues:
- "Cannot construct instance"
- "No suitable constructor found"
- "Cannot deserialize from Object value"
If serialization works but deserialization fails, focus on object construction, not on field visibility or JSON naming first.
Common Pitfalls
- Assuming
@Valueor@Dataautomatically makes a class deserializable by Jackson. - Relying on generated constructors without preserving parameter metadata.
- Mixing immutable design with a no-args constructor fix and then wondering why invariants become weak.
- Using
@Builderwithout telling Jackson how that builder should be consumed.
Summary
- The issue is usually missing constructor metadata, not a total Lombok and Jackson incompatibility.
- The most reliable fix is an explicit
@JsonCreatorconstructor with@JsonPropertyannotations. - '
-parametersandlombok.configcan help Jackson infer constructor arguments.' - Mutable DTOs can fall back to a no-args constructor plus setters.
- If deserialization fails, investigate how Jackson is supposed to instantiate the class.
Related reading
- Lombok added but getters and setters not recognized in Intellij IDEA
- Lombok annotations do not compile under Intellij idea
- Lombok is not generating getter and setter
- Long vs Integer, long vs int, what to use and when?
- Loop doesn't see value changed by other thread without a print statement
- Lossless JPEG Rotate 90/180/270 degrees in Java?
- Mac OS X and multiple Java versions
- Machine learning challenge diagnosing program in java/groovy datamining, machine learning

OOD Fundamentals
Master object-oriented design from first principles, SOLID, design patterns, and classic interview problems with hands-on coding.
View the courseTrack what you have practised
A free account saves your progress, solutions and study plan across every problem on Codemia.
Interview Questions practice on Codemia
Over 8,000 real interview questions from top companies, searchable by company and role.