在我从Spring 4.3.4迁移到4.3.7时,我在添加Jackson-core依赖后遇到了NoClassDefFound错误。
由此引起的错误: org.springframework.beans.BeanInstantiationException: 无法实例化 [org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter]: 构造函数抛出异常; 嵌套异常是 java.lang.NoClassDefFoundError: com / fasterxml / jackson / core / util / DefaultIndenter
我尝试添加jackson-core。
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.8.5</version>
</dependency>
依赖关系也有问题,但没有运气。
任何能够阐明此事的人将不胜感激。
谢谢, Vinod
DefaultIndenter
类是在Jackson 2.5中引入的。也许你项目中的某个其他部分会引入一个早期版本,其中没有这个类。可能是通过某个库的传递依赖关系而来。尝试运行mvn dependency:tree
命令并查看输出中是否有早期的Jackson版本。 - Chris Nauroth