Fix Jackson Cannot Construct Instance and Missing Creator
Fix Jackson's Cannot construct instance error by giving the class a creator Jackson can call, using a record, or choosing a concrete type for interfaces.

Cannot construct instance of X (no Creators, like default constructor, exist) is Jackson saying it does not know how to build the object it was asked to read. It looked at the class, found no constructor or factory it was allowed to call with the JSON's fields, and gave up. The class is usually fine as Java, and the fix is a small change that tells Jackson how to create it. This post covers the six causes in order of frequency, with the fix for each: constructors with no parameter names, Lombok, interfaces and abstract types, inner classes, access modifiers and generic types. It applies to Jackson 2.x and 3.x as bundled with Spring Boot, on JDK 25.
What the error looks like
com.fasterxml.jackson.databind.exc.InvalidDefinitionException:
Cannot construct instance of `com.example.api.Address`
(no Creators, like default constructor, exist): cannot deserialize from Object value
(no delegate- or property-based Creator)
at [Source: (PushbackInputStream); line: 1, column: 2]In a Spring application it surfaces as an HttpMessageNotReadableException with a 400 response, covered more generally in JSON parse errors. Read the type name in the message. It tells you which class Jackson could not construct, and that is not always the class of the controller parameter: it can be a nested field several levels down.
Cause 1: only an all-arguments constructor
public class Address {
private final String street;
private final String city;
public Address(String street, String city) {
this.street = street;
this.city = city;
}
// getters
}Jackson's default way of building an object is a no-argument constructor followed by setters or field writes. This class has neither. With the multi-argument constructor Jackson would need to know which JSON property goes into which parameter, and Java does not keep parameter names at run time unless the code is compiled with -parameters. Three fixes work.
Compile with -parameters and register the parameter-names module. Spring Boot does both: the Spring Boot Maven and Gradle parent configurations pass -parameters, and Boot registers jackson-module-parameter-names. If you build without the Boot parent, add <parameters>true</parameters> to the compiler plugin configuration. That is the usual cause when "it worked in the IDE and fails on the build server".
Annotate the constructor with @JsonCreator and the parameters with @JsonProperty, which needs nothing from the compiler:
@JsonCreator
public Address(@JsonProperty("street") String street, @JsonProperty("city") String city) { ... }Or make the class a record, which Jackson reads directly:
public record Address(String street, String city) { }Records work without annotations in current Jackson versions, and they are the shortest answer for a plain data class. The comparison with other styles is in records versus Lombok, and the language features in the modern Java guide.
Cause 2: Lombok and constructors
@Data generates a no-argument constructor only when no other constructor exists and no final fields need initialising. @Value makes fields final and generates an all-arguments constructor, and @Builder generates an all-arguments constructor too, hiding the default one. The result is a class that looks fine and is the same case as above. Add @NoArgsConstructor (and @AllArgsConstructor if a builder needs it) for a mutable class, or add @Jacksonized with @Builder, which tells Jackson to use the builder:
@Value
@Builder
@Jacksonized
public class Address { String street; String city; }Lombok's lombok.config option lombok.anyConstructor.addConstructorProperties = true makes it emit the @ConstructorProperties annotation, which Jackson understands. Another reason to prefer a record when the class is only data.
Cause 3: an interface or abstract class
public class Order {
private Payment payment; // Payment is an interface
}Jackson cannot instantiate an interface or an abstract class, so the JSON {"payment": {...}} has nothing to build. It needs to know the concrete type. If there is only one implementation, say so:
@JsonDeserialize(as = CardPayment.class)
public interface Payment { }If the JSON can carry several implementations, include a type discriminator and register the subtypes:
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type")
@JsonSubTypes({
@JsonSubTypes.Type(value = CardPayment.class, name = "card"),
@JsonSubTypes.Type(value = TransferPayment.class, name = "transfer")
})
public sealed interface Payment permits CardPayment, TransferPayment { }Do not use JsonTypeInfo.Id.CLASS with untrusted input. It lets the client name any Java class to instantiate, which is a deserialisation vulnerability; use NAME with an explicit list, as above. The general danger is described in insecure deserialization in the security cluster.
Cause 4: a non-static inner class
public class Report {
public class Line { public String text; } // inner class: needs a Report instance
}A non-static inner class holds a hidden reference to an instance of the outer class, so its constructor takes the outer instance as a parameter that JSON cannot supply. Make it static, or move it to its own file. This one is easy to cause by pasting a class inside another for convenience.
Cause 5: a private constructor and no access
A private no-argument constructor is fine for Jackson, which can call it through reflection when MapperFeature.CAN_OVERRIDE_ACCESS_MODIFIERS is on (the default). It fails under the Java module system when the package is not opened to Jackson, or in a native image when the class is not registered for reflection. In a modular application, add opens com.example.api to com.fasterxml.jackson.databind; to module-info.java. In GraalVM native builds, register the class for reflection; the same fix for Quarkus is in reflection config in native builds.
Cause 6: the type is generic and erased
A method that deserialises into List<Address> using Address.class or a raw List.class gets a list of LinkedHashMaps, and a later cast fails. For a generic target, pass a TypeReference:
List<Address> addresses = mapper.readValue(json, new TypeReference<List<Address>>() { });In Spring, @RequestBody List<Address> keeps the generic type because the parameter's declared type is available to the converter. The failure appears in hand-written code that loses the type through a helper method with a Class<T> parameter.
A quick way to find the culprit
Write a unit test with a plain ObjectMapper and the failing JSON, and run it outside Spring. If it fails there with the same message, the class is the problem. If it passes, the mapper configuration inside the application differs, usually by a missing module or a changed visibility setting. Compare mapper.getRegisteredModuleIds() in both. When the JSON uses unknown properties, you may meet a different error, unrecognized field.
A checklist for the next time
When the message appears, ask four questions in order. Does the class have a constructor Jackson can call, either a no-argument one or one with annotated or named parameters? Is the declared type concrete, and if it is an interface, is there a rule that maps it to an implementation? Is the class a static nested or top-level class? Does the module system or native image configuration allow reflection on it? Most reports are answered by the first two. Writing a small unit test for each request type, with a sample JSON file, catches a broken creator at build time and costs a few lines. The tests also protect against the day someone adds a field to a record or a constructor argument to a class and silently changes how the JSON binds.
Where this does not apply
If the message says Cannot deserialize value of type X from String, the creator exists and the value is wrong, for example an enum name that does not match; that is a separate error with a separate fix. The reference for Jackson in Boot is JSON support, and the library documentation is at github.com/FasterXML/jackson-docs.


