【问题标题】:java.lang.NoSuchFieldError: com/fasterxml/jackson/annotation/JsonInclude$Include.USE_DEFAULTSjava.lang.NoSuchFieldError: com/fasterxml/jackson/annotation/JsonInclude$Include.USE_DEFAULTS
【发布时间】:2021-12-09 13:17:48
【问题描述】:

我正在使用spring 5.3.7 当我启动我的应用程序时,它会返回以下错误:

Instantiation of bean failed; nested exception is
org.springframework.beans.BeanInstantiationException: Failed to instantiate
[org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter]:
Constructor threw exception; nested exception is java.lang.NoSuchFieldError:
com/fasterxml/jackson/annotation/JsonInclude$Include.USE_DEFAULTS

我正在使用实现 USE_DEFAULTS 枚举的jackson-annotations-2.10.3.jar。 我希望有人可以帮助我。

【问题讨论】:

  • 检查你的依赖图看看你是否有其他版本的杰克逊存在
  • 请编辑问题以将其限制为具有足够详细信息的特定问题,以确定适当的答案。
  • 非常感谢。问题已解决,删除旧版本的库。

标签: java spring jackson jackson-annotations


【解决方案1】:

我不确定,但你应该检查一下@Service、@Controller、@Respository 等注释,你可能会错过任何一个注释。请仔细检查,它可能会帮助您。

【讨论】:

    【解决方案2】:

    为了处理这个错误,我们必须清除所有.class文件并重新编译以确保所有文件都是最新的。

    如果这个错误在运行时仍然存在,可能是编译时引用的依赖与运行时版本不同。这里需要检查一下各种路径和版本是否有误。

    Maven 项目一般执行 mvn clean。

    希望你的问题可以解决

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-02-01
      • 2021-11-10
      • 2020-11-24
      • 2015-08-02
      • 1970-01-01
      • 2021-10-08
      • 2018-04-26
      相关资源
      最近更新 更多