当我从spring 4.3.4迁移到4.3.7时,我在添加Jackson-core依赖后面临NoclassDefined错误
引发者:org.springframework.beans.BeanInstantiationException:无法实例化[org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter]:构造函数抛出异常;嵌套异常是java.lang.NoClassDefFoundError:com / fasterxml / jackson / core / util / DefaultIndenter
我试着添加杰克逊核心
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.8.5</version>
</dependency>
依赖也没有运气
任何能够对此有所了解的人都将不胜感激。
谢谢Vinod
如果其他人通过Google发现了这个问题,并且您使用的是SpringBoot
,那么这就解决了我的问题。尝试设置您的pom文件的父级(即Maven项目):
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.2.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
这将把spring-boot-starter
版本设置为2.0.2
,而不是1.x
,这是默认的(至少对我而言)。
继the comment of Chris Nauroth之后,我使用了mvn dependency:tree
,发现1.x
版本的SpringBoot使用2.4.x
版本的Jackson
,而spring-boot-starter
版本2.x
使用Jackson 2.5
或更高版本。
我有这个问题,使用Spring 4.3.22.RELEASE和jackson-databind 2.2.3,我只需要升级到2.9.8并且问题解决了。