beta.blog

How to fix: ObjectMapper cannot be resolved to a type (Java/Maven)

by on Jan.30, 2019, under Programming

If you happen to receive an error message reading:

ObjectMapper cannot be resolved to a type

Make sure to add the following Maven dependency:

<dependency>
    <groupId>com.fasterxml.jackson.core</groupId>
    <artifactId>jackson-databind</artifactId>
    <version>2.9.8</version>
</dependency>

Make sure to use the latest version of this library instead of version 2.9.8!

Source: https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-databind

You might as well stumble across this error because you still have imports like below in your code:

import org.codehaus.jackson.map.ObjectMapper;

Make sure to replace these imports with:

import com.fasterxml.jackson.databind.ObjectMapper;

:,

Leave a Reply

*

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!