java.lang.NoClassDefFoundError:org / apache / http / nio / conn / NHttpClientConnectionManager

时间:2015-08-04 19:50:32

标签: java maven jar https jwt

我目前有这些罐子:

  • httpasyncclient-4.0-beta3.jar
  • 的HttpClient-4.5.jar
  • HttpClient的缓存-4.5.jar
  • HttpClient的赢-4.5.jar
  • 的HttpCore-4.3.jar
  • 的HttpCore-NIO-4.1-beta2.jar
  • httpmime-4.2.3.jar
  • SLF4J-API-1.7.12.jar

我的java方法错误来自:

 private HttpResponse<JsonNode> jwtAuthPost(String assertion) throws UnirestException {
    HttpResponse<JsonNode> jsonResponse = Unirest.post(AUTH_URL)
              .header("accept", "application/json")
              .field("grant_type", JWT_GRANT_TYPE)
              .field("client_id", this.clientId)
              .field("client_secret", this.clientSecret)
              .field("assertion", assertion)
              .asJson();  //error here

    return jsonResponse;
}

我猜我在这个地方有一个插件,但我似乎无法在任何地方找到它。

其余的错误记录

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/http/nio/conn/NHttpClientConnectionManager
  at com.mashape.unirest.http.HttpClientHelper.prepareRequest(HttpClientHelper.java:154)
  at com.mashape.unirest.http.HttpClientHelper.request(HttpClientHelper.java:134)
  at com.mashape.unirest.request.BaseRequest.asJson(BaseRequest.java:68)

1 个答案:

答案 0 :(得分:2)

包括

httpasyncclient-4.0-β的 4 的.jar

而不是

httpasyncclient-4.0-β的 3 的.jar

请参阅:http://www.java2s.com/Code/Jar/h/Downloadhttpasyncclient40beta4jar.htm