【问题标题】:Handler dispatch failed; nested exception is java.lang.NoClassDefFoundError: org/apache/http/client/HttpClient处理程序调度失败;嵌套异常是 java.lang.NoClassDefFoundError: org/apache/http/client/HttpClient
【发布时间】:2019-07-03 10:17:16
【问题描述】:

enter image description here

我尝试访问 API 然后发生这种类型的错误 - org.springframework.web.util.NestedServletException: Handler dispatch failed;嵌套异常是 java.lang.NoClassDefFoundError: org/apache/http/client/HttpClient

【问题讨论】:

  • 请点击上方链接在此处输入图片描述
  • 你需要在你的类路径中的 jar。
  • 我已经在 pom.xml 里面添加了这个依赖
  • 也在类路径中添加

标签: java spring wildfly


【解决方案1】:

NoClassDefFoundError 表示该类在编译时可用,但在运行时无法找到定义。 尝试通过升级你的 httpclient 依赖,

<dependency>
    <groupId>org.apache.httpcomponents</groupId>
    <artifactId>httpclient</artifactId>
    <version>4.5.3</version>
</dependency>

然后运行clean install

【讨论】:

    【解决方案2】:

    确保您已根据您使用的工具添加了 apache http 组件的依赖项。按照这个链接 [依赖 apache http 组件][1]https://hc.apache.org/httpcomponents-client-ga/httpclient/dependency-info.html 添加依赖项。

    【讨论】:

    • 尝试升级你的 httpclient 依赖然后运行 ​​clean install org.apache.httpcomponentshttpclient4.5.3版本> 依赖>
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-11-01
    • 2015-03-08
    • 1970-01-01
    • 1970-01-01
    • 2017-10-20
    • 1970-01-01
    相关资源
    最近更新 更多