How to fix 'no suitable constructor' exception ?

org.codehaus.jackson.map.JsonMappingException: No suitable constructor found for type

This exception is provoked by the impossibility to create object from provided input. For example it can occur when our object has no default empty constructor:

public class PersonDto {
  private String name;

  public PersonDto(String name) {
    this.name = name;
  }
}

One of possible solutions is @JsonProperty annotation used on PersonDto constructor:

public PersonDto(@JsonProperty("name") String name) {
  this.name = name;
}

This annotation helps Jackson to link JSON field to attribute specified in class constructors.