Programming
How to fix: ObjectMapper cannot be resolved to a type (Java/Maven)
by admin 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;