FaceRect

KOSTENLOS
Durch apicloud | Aktualisiert hace 22 días | Media
Popularität

0.4 / 10

Latenz

12ms

Service Level

0%

Health Check

N/A

Zurück zu allen Diskussionen

NoSuchFieldError

Rapid account: Ashishspanicker
ashishspanicker
hace 10 años

Hi

I am trying to use the face rect api from my java appliaction. I have added the necessary jars and executed the application. Nu I am getting the following error.

Exception in thread “main” java.lang.NoSuchFieldError: DEFAULT
at org.apache.http.impl.nio.client.HttpAsyncClientBuilder.build(HttpAsyncClientBuilder.java:353)
at com.mashape.unirest.http.options.Options.refresh(Options.java:43)
at com.mashape.unirest.http.options.Options.<clinit>(Options.java:27)
at com.mashape.unirest.http.HttpClientHelper.prepareRequest(HttpClientHelper.java:146)
at com.mashape.unirest.http.HttpClientHelper.request(HttpClientHelper.java:123)
at com.mashape.unirest.request.BaseRequest.asJson(BaseRequest.java:68)
at Main.main(Main.java:20)
Java Result: 1

This is the java code which I executed.

public class Main {

public static void main(String[] args) throws UnirestException, JSONException {
    HttpResponse<JsonNode> request = Unirest.post("https://apicloud-facerect.p.mashape.com/process-file.json")
            .header("X-Mashape-Authorization", "YfG4JGGx1u5tsXE75EzzADm7DKfKZler")
            .field("image", new File("d:\\f.jpg"))
            .field("features", "false")
            .asJson();
    
}

}

Rapid account: Apicloud
apicloud Commented hace 10 años

Hi there!

Your code seems correct and it works for me. I suppose you have an issue with external JARs. Please make sure you downloaded and added all the following JARs with exact same versions:

  1. http://oss.sonatype.org/content/repositories/releases/com/mashape/unirest/unirest-java/1.3.8/unirest-java-1.3.8.jar
  2. https://code.google.com/p/org-json-java/downloads/list
  3. ALL JARs from the lib folder: http://archive.apache.org/dist/httpcomponents/httpasyncclient/binary/httpcomponents-asyncclient-4.0-bin.zip
  4. ALL JARs from the lib folder: http://archive.apache.org/dist/httpcomponents/httpclient/binary/httpcomponents-client-4.3.2-bin.zip

After adding all the JARs your code should work. Hope that helps!

Andy

Rapid account: Ashishspanicker
ashishspanicker Commented hace 10 años

Hey Andy

Thanks for the support. As you mentioned jar files was the issue. Now its working fine.

Thanks
Ashish

Nehmen Sie an der Diskussion teil - fügen Sie unten einen Kommentar hinzu:

Anmelden / Registrieren, um neue Kommentare zu veröffentlichen