简体   繁体   中英

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

I currently have these jars:

  • httpasyncclient-4.0-beta3.jar
  • httpclient-4.5.jar
  • httpclient-cache-4.5.jar
  • httpclient-win-4.5.jar
  • httpcore-4.3.jar
  • httpcore-nio-4.1-beta2.jar
  • httpmime-4.2.3.jar
  • slf4j-api-1.7.12.jar

My java method where the error comes from is:

 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;
}

I'm guessing there is a plugin somewhere that I'm missing for this, but I can't seem to find it anywhere.

Rest of Error Log

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)

Include

httpasyncclient-4.0-beta 4 .jar

instead of

httpasyncclient-4.0-beta 3 .jar

See: http://www.java2s.com/Code/Jar/h/Downloadhttpasyncclient40beta4jar.htm

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM