转载

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

当我从 spring

4.3.4迁移到4.3.7时,我在添加Jackson-core依赖后面临NoclassDefined错误

Caused By: org.springframework.beans.BeanInstantiationException:

Failed to instantiate

[org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter]:

Constructor threw exception; nested exception is

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>

依赖也没有运气

任何能够阐明这一点的人都会受到赞赏.

谢谢

维诺德

如果其他人通过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依赖:tree并看到1.x版本的SpringBoot使用了2.4.x版本的Jackson,而spring-boot-starter版本2.x使用了Jackson 2.5或更高版本.

翻译自:https://stackoverflow.com/questions/45060443/spring-4-3-7-is-throwing-java-lang-noclassdeffounderror-com-fasterxml-jackson-c

原文  https://codeday.me/bug/20190112/506351.html
正文到此结束
Loading...