exception - Getting "java.lang.NoClassDefFoundError: org/apache/http/nio/reactor/IOReactorException" -
i'm trying utilize mashape api, have added next libraries (jars) unirest, httpasyncclient, httpclient, httpmime, org.json, commons-longging, httpcore project.
i'm trying run...
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 apr 1977") .field("gender", "female") .asjson();
but exception...
exception in thread "main" java.lang.noclassdeffounderror: org/apache/http/nio/reactor/ioreactorexception @ com.mashape.unirest.http.httpclienthelper.preparerequest(httpclienthelper.java:154) @ com.mashape.unirest.http.httpclienthelper.request(httpclienthelper.java:131) @ com.mashape.unirest.request.baserequest.asjson(baserequest.java:68) @ test.test.main(test.java:24) caused by: java.lang.classnotfoundexception: org.apache.http.nio.reactor.ioreactorexception @ java.net.urlclassloader$1.run(urlclassloader.java:366) @ java.net.urlclassloader$1.run(urlclassloader.java:355) @ java.security.accesscontroller.doprivileged(native method) @ java.net.urlclassloader.findclass(urlclassloader.java:354) @ java.lang.classloader.loadclass(classloader.java:425) @ sun.misc.launcher$appclassloader.loadclass(launcher.java:308) @ java.lang.classloader.loadclass(classloader.java:358)
i've tried googling around can't find out wrong.
any help appreciated.
i had same problem resolved after adding next dependency in project pom.xml file
<dependency> <groupid>org.apache.httpcomponents</groupid> <artifactid>httpcore-nio</artifactid> <version>4.4.3</version> </dependency>
java exception jar unirest
No comments:
Post a Comment