Spring 4.3.7抛出java.lang.NoClassDefFoundError:com / fasterxml / jackson / core / util / DefaultIndenter

问题描述 投票:9回答:2

当我从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

java spring spring-mvc jackson weblogic12c
2个回答
0
投票

如果其他人通过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或更高版本。


0
投票

我有这个问题,使用Spring 4.3.22.RELEASE和jackson-databind 2.2.3,我只需要升级到2.9.8并且问题解决了。

© www.soinside.com 2019 - 2024. All rights reserved.