我正在尝试使用 Mashape api,我在我的项目中添加了以下库 (jars) unirest、httpasyncclient、httpclient、httpmime、org.json、commons-longging、httpcore。
我试着跑...
HttpResponse<JsonNode> response = Unirest.post("https://life-left.p.mashape.com/time-left")
.header("X-Mashape-Key", "1NZITOdDGqmshKRAEdDbX0tp0WV2p1RR5SSjsnQYQIVwrANkhC")
.header("Content-Type", "application/x-www-form-urlencoded")
.field("birth", "22 April 1977")
.field("gender", "female")
.asJson();
但我得到了这个例外......
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/http/nio/reactor/IOReactorException
at com.mashape.unirest.http.HttpClientHelper.prepareRequest(HttpClientHelper.java:154)
at com.mashape.unirest.http.HttpClientHelper.request(HttpClientHelper.java:131)
at com.mashape.unirest.request.BaseRequest.asJson(BaseRequest.java:68)
at test.Test.main(Test.java:24)
Caused by: java.lang.ClassNotFoundException: org.apache.http.nio.reactor.IOReactorException
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
我试过谷歌搜索,但我无法找出问题所在。
任何帮助,将不胜感激。