aws / aws-sdk-java

The official AWS SDK for Java 1.x (In Maintenance Mode, End-of-Life on 12/31/2025). The AWS SDK for Java 2.x is available here: https://github.com/aws/aws-sdk-java-v2/
https://aws.amazon.com/sdkforjava
Apache License 2.0
4.13k stars 2.83k forks source link

UnknownHostException: rekognition.us-east-1.amazonaws.com #1975

Closed vbijjam1 closed 5 years ago

vbijjam1 commented 5 years ago

I am trying to execute the sample code given here : https://docs.aws.amazon.com/rekognition/latest/dg/images-bytes.html

I am getting com.amazonaws.SdkClientException: Unable to execute HTTP request: rekognition.us-east-1.amazonaws.com at com.amazonaws.http.AmazonHttpClient$RequestExecutor.handleRetryableException(AmazonHttpClient.java:1175) Caused by: java.net.UnknownHostException: rekognition.us-east-1.amazonaws.com at java.net.InetAddress.getAllByName0(InetAddress.java:1281) at java.net.InetAddress.getAllByName(InetAddress.java:1193) at java.net.InetAddress.getAllByName(InetAddress.java:1127) at com.amazonaws.SystemDefaultDnsResolver.resolve(SystemDefaultDnsResolver.java:27) at com.amazonaws.http.DelegatingDnsResolver.resolve(DelegatingDnsResolver.java:38) at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:112) at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:374) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at com.amazonaws.http.conn.ClientConnectionManagerFactory$Handler.invoke(ClientConnectionManagerFactory.java:76) at com.amazonaws.http.conn.$Proxy218.connect(Unknown Source)

Caused by: java.net.UnknownHostException: rekognition.us-east-1.amazonaws.com at java.net.InetAddress.getAllByName0(InetAddress.java:1281) at java.net.InetAddress.getAllByName(InetAddress.java:1193) at java.net.InetAddress.getAllByName(InetAddress.java:1127) at com.amazonaws.SystemDefaultDnsResolver.resolve(SystemDefaultDnsResolver.java:27) at com.amazonaws.http.DelegatingDnsResolver.resolve(DelegatingDnsResolver.java:38) at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:112) at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:374) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at com.amazonaws.http.conn.ClientConnectionManagerFactory$Handler.invoke(ClientConnectionManagerFactory.java:76) at com.amazonaws.http.conn.$Proxy218.connect(Unknown Source) Development environment: OS : Window

Is there any additional steps that i need to do to access the rekognition sdk detectLabels operation from local desktop using local Image file?

debora-ito commented 5 years ago

Hi @vbijjam1, could you share a code snippet showing how you are creating the client?

I ran the code example on the docs link you posted and it ran without issues.

vbijjam1 commented 5 years ago

Hi Debora, If my laptop is connected to cooperate network then its not working. When i tried it at home its working. Can you please let me know how i can get it working connected to my work network. Please suggest

debora-ito commented 5 years ago

Your corporate network is probably using a proxy. If that's the case, you'll need to configure the proxy server settings (proxy host, port, and username/password) through the ClientConfiguration object.

debora-ito commented 5 years ago

Closing this, feel free to reopen if you have further questions.