failed to instantiate com.fasterxml.jackson.datatype.jsr310.javatimemodule 에러 원인과 해결 방법
에러내용
아래의 에러메세지가 뜨며 프로그램 실행에 실패했다.
org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.fasterxml.jackson.datatype.jsr310.JavaTimeModule]: Unresolvable class definition; nested exception is java.lang.NoClassDefFoundError: com/fasterxml/jackson/databind/ser/std/ToStringSerializerBase
at org.springframework.beans.BeanUtils.instantiateClass (BeanUtils.java:149)
at org.springframework.http.converter.json.Jackson2ObjectMapperBuilder.registerWellKnownModulesIfAvailable (Jackson2ObjectMapperBuilder.java:805)
at org.springframework.http.converter.json.Jackson2ObjectMapperBuilder.configure (Jackson2ObjectMapperBuilder.java:669)
at org.springframework.http.converter.json.Jackson2ObjectMapperBuilder.build (Jackson2ObjectMapperBuilder.java:652)
at org.springframework.http.converter.json.MappingJackson2HttpMessageConverter.<init> (MappingJackson2HttpMessageConverter.java:59)
at org.springframework.http.converter.support.AllEncompassingFormHttpMessageConverter.<init> (AllEncompassingFormHttpMessageConverter.java:76)
at org.springframework.web.client.RestTemplate.<init> (RestTemplate.java:147)
원인
위의 메세지를 구글링 해보니 jackson-datatype 라이브러리의 버전이 안맞아 생기는 오류로 파악되었다.
해결 방법
build.gradle 의존성 주입에 사용된 기존 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310' 라이브러리를 'com.fasterxml.jackson.datatype:jackson-datatype-jdk8'로 변경하니 정상적으로 프로그램이 실행되었다!
참고
How to fix org.springframework.beans.BeanInstantiationException: Failed to instantiate
I'm building a project from akka and spring, this is my POM.xml <project> <modelVersion>4.0.0</modelVersion> <parent> <groupId>org.springframework.boot</groupId...
stackoverflow.com
https://github.com/FasterXML/jackson-modules-java8/issues/101
[Bug] [Help resolving missing deps needed] Exception in `JavaTimeModule` · Issue #101 · FasterXML/jackson-modules-java8
Deployed artifacts: META-INF/lib/jackson-annotations-2.9.8.jar META-INF/lib/jackson-core-2.9.8.jar META-INF/lib/jackson-databind-2.9.8.jar META-INF/lib/jackson-datatype-jsr310-2.9.8.jar META-INF/li...
github.com