tencentyun / image-java-sdk-v2.0

84 stars 73 forks source link

调用驾驶证识别接口报错:code":-3 Caused by: java.net.UnknownHostException #13

Closed muchenxiaoxi closed 5 years ago

muchenxiaoxi commented 5 years ago

报错: {"code":-3,"message":"杩欐槸鍦ㄤ富鏈哄悕瑙f瀽鏃堕�氬父鍑虹幇鐨勬殏鏃堕敊璇紝瀹冩剰鍛崇潃鏈湴鏈嶅姟鍣ㄦ病鏈変粠鏉冨▉鏈嶅姟鍣ㄤ笂鏀跺埌鍝嶅簲銆� (recognition.image.myqcloud.com)"} Caused by: java.net.UnknownHostException: 杩欐槸鍦ㄤ富鏈哄悕瑙f瀽鏃堕�氬父鍑虹幇鐨勬殏鏃堕敊璇紝瀹冩剰鍛崇潃鏈湴鏈嶅姟鍣ㄦ病鏈変粠鏉冨▉鏈嶅姟鍣ㄤ笂鏀跺埌鍝嶅簲銆� (recognition.image.myqcloud.com) at java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method) at java.net.InetAddress$2.lookupAllHostAddr(InetAddress.java:928) at java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1323) at java.net.InetAddress.getAllByName0(InetAddress.java:1276) at java.net.InetAddress.getAllByName(InetAddress.java:1192) at java.net.InetAddress.getAllByName(InetAddress.java:1126) at com.squareup.okhttp.Dns$1.lookup(Dns.java:39) at com.squareup.okhttp.internal.http.RouteSelector.resetNextInetSocketAddress(RouteSelector.java:175) at com.squareup.okhttp.internal.http.RouteSelector.nextProxy(RouteSelector.java:141) at com.squareup.okhttp.internal.http.RouteSelector.next(RouteSelector.java:83) at com.squareup.okhttp.internal.http.StreamAllocation.findConnection(StreamAllocation.java:174) at com.squareup.okhttp.internal.http.StreamAllocation.findHealthyConnection(StreamAllocation.java:126) at com.squareup.okhttp.internal.http.StreamAllocation.newStream(StreamAllocation.java:95) at com.squareup.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:281) at com.squareup.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:224) at com.squareup.okhttp.Call.getResponse(Call.java:286) at com.squareup.okhttp.Call$ApplicationInterceptorChain.proceed(Call.java:243) at com.squareup.okhttp.Call.getResponseWithInterceptorChain(Call.java:205) at com.squareup.okhttp.Call.execute(Call.java:80) at com.qcloud.image.http.DefaultImageHttpClient.sendPostRequest(DefaultImageHttpClient.java:117)

public static void main(String args[]){ ImageClient imageClient = new ImageClient("AAAAAAA", "AAAAAAA", "AAAAAAA", ImageClient.NEW_DOMAIN_recognition_image_myqcloud_com); try{ OcrDrivingLicenceRequest request = new OcrDrivingLicenceRequest("drive-license1", OcrDrivingLicenceRequest.TYPE_DRIVER_LICENSE, "http://drive-license1-1258218565.picgz.myqcloud.com/timg2.jpg"); String result = imageClient.ocrDrivingLicence(request); System.out.println(result ); }catch(Exception e){ e.printStackTrace(); } }

muchenxiaoxi commented 5 years ago

已经解决,没有设置代理的原因,设置了代理之后就可以了。