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.
Telegram channel

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

If I saved your day, you can support me 🤝

Leave a Reply

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