Jackson Mismatched Input Exception

Suppose you are trying to do something like:

public MyConfiguration myConfiguration() throws IOException {
    ObjectMapper yamlMapper = new ObjectMapper(new YAMLFactory());
    return yamlMapper.readValue(new File("configuration.yml"), MyConfiguration.class);

But the output is something like:


There are at least two reasons:

  • Configuration file does not exist;
  • Setters for MyConfiguration.class are named incorrectly or cannot be accessed.

If you still have any questions, feel free to ask me in the comments under this article, or write me on promark33@gmail.com.

Leave a Reply

Your email address will not be published. Required fields are marked *