Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Unable to connect https://ofc.p.mashape.com/directConvert/ service through Mashup API  RSS feed

 
anji anjaiah
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI All,

I am facing below problem while i am connecting with any services through(MashUp API)

I am using below Jars
i)commons-logging-1.1.3.jar
ii)httpasyncclient-4.0-beta4.jar
iii)httpclient-4.3.6.jar
iv)httpcore-4.3.3.jar
v)httpcore-nio-4.1-beta2.jar
vi)httpmime-4.3.6.jar
vii)unirest-java-1.3.27.jar

Code:
public static void main(String[] args) throws UnirestException {
HttpResponse<InputStream> response = Unirest.post("https://ofc.p.mashape.com/directConvert/")
.header("X-Mashape-Key", "Y3MxEWkOX3mshcvQ85SZCoIqucVMp1qRpjbjsn0TYnnY8c1fIR")
.field("file", new File("<file goes here>"))
.field("format", "woff")
.field("output", "tar.gz")
.asBinary();
System.out.println(response.getStatus());

/*HttpAsyncClient httpclient = new DefaultHttpAsyncClient();
httpclient.start();
HttpPost post = new HttpPost("https://ofc.p.mashape.com/directConvert/");//+postPairs.get(0).getValue());
//HttpPost post = new HttpPost("http://www.google.com");

Future<HttpResponse> future = httpclient.execute(post, null);*/
}
Facing Problem ::
Exception in thread "main" java.lang.NoSuchMethodError: org.apache.http.impl.nio.reactor.DefaultConnectingIOReactor: method <init>()V not found
at com.mashape.unirest.http.options.Options.refresh(Options.java:68)
at com.mashape.unirest.http.options.Options.<clinit>(Options.java:36)
at com.mashape.unirest.http.HttpClientHelper.prepareRequest(HttpClientHelper.java:153)
at com.mashape.unirest.http.HttpClientHelper.request(HttpClientHelper.java:133)
at com.mashape.unirest.request.BaseRequest.asBinary(BaseRequest.java:80)
at com.iwinner.mashap.consumer.api.MashMain.main(MashMain.java:19)
 
Vinod Awar
Ranch Hand
Posts: 129
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, The exception is self explanotory. The method definition of init() is not found in the specified class in classpath.
 
anji anjaiah
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for reply , i got solutions , we need to add httpcore-nio-4.3.jar file because my previous adding jar(httpcore-nio-4.1-beta2.jar) getting problem.

Now am able to connect with marshup api endpoints


Thanks
AnjaiahSpr
 
James Boswell
Bartender
Posts: 1051
5
Chrome Eclipse IDE Hibernate
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just to clarify, the reason for this problem is because unirest-java-1.3.27.jar relies on the classes within httpcore-nio-4.3.jar, not the older version httpcore-nio-4.1-beta2.jar.
 
anji anjaiah
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks James for your clarification.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!