Hello.
We are trying to use Google Ads API with Client Library of Java.
But it returns exception `java.net.UnknownHostException`.
The total error message is the following.
```
05-Apr-2022 16:51:35.365 WARNING [grpc-default-executor-138] io.grpc.internal.ManagedChannelImpl$NameResolverListener.handleErrorInSyncContext [Channel<83>: (
googleads.googleapis.com:443)] Failed to resolve name. status=Status{code=UNAVAILABLE, description=Unable to resolve host
googleads.googleapis.com, cause=java.net.UnknownHostException: host: unknown error
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 java.net.InetAddress.getByName(InetAddress.java:1076)
at io.grpc.internal.ProxyDetectorImpl.detectProxy(ProxyDetectorImpl.java:260)
at io.grpc.internal.ProxyDetectorImpl.proxyFor(ProxyDetectorImpl.java:200)
at io.grpc.internal.DnsNameResolver.detectProxy(DnsNameResolver.java:269)
at io.grpc.internal.DnsNameResolver.access$600(DnsNameResolver.java:66)
at io.grpc.internal.DnsNameResolver$Resolve.run(DnsNameResolver.java:310)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
```
We already testes the following points.
- Our application is running on the instance of Amazon EC2. We can success (no packet loss) to send ping to the domain, and dig command also returns `NOERROR`. The EC2 instance can identify the domain.
```
sh-4.2$ dig
googleads.googleapis.com; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.37.rc1.47.amzn1 <<>>
googleads.googleapis.com;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 17952
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:
;
googleads.googleapis.com. IN A
;; ANSWER SECTION:
googleads.googleapis.com. 94 IN A 142.250.196.106
;; Query time: 1 msec
;; SERVER: 172.31.0.2#53(172.31.0.2)
;; WHEN: Fri Apr 8 10:04:28 2022
;; MSG SIZE rcvd: 58
sh-4.2$ ping
googleads.googleapis.comPING
googleads.googleapis.com (142.250.196.106) 56(84) bytes of data.
64 bytes from
nrt12s35-in-f10.1e100.net (142.250.196.106): icmp_seq=1 ttl=105 time=2.38 ms
64 bytes from
nrt12s35-in-f10.1e100.net (142.250.196.106): icmp_seq=2 ttl=105 time=2.32 ms
64 bytes from
nrt12s35-in-f10.1e100.net (142.250.196.106): icmp_seq=3 ttl=105 time=2.35 ms
64 bytes from
nrt12s35-in-f10.1e100.net (142.250.196.106): icmp_seq=4 ttl=105 time=2.36 ms
64 bytes from
nrt12s35-in-f10.1e100.net (142.250.196.106): icmp_seq=5 ttl=105 time=2.43 ms
64 bytes from
nrt12s35-in-f10.1e100.net (142.250.196.106): icmp_seq=6 ttl=105 time=2.39 ms
64 bytes from
nrt12s35-in-f10.1e100.net (142.250.196.106): icmp_seq=7 ttl=105 time=2.98 ms
^C64 bytes from
nrt12s35-in-f10.1e100.net (142.250.196.106): icmp_seq=8 ttl=105 time=2.32 ms
64 bytes from
nrt12s35-in-f10.1e100.net (142.250.196.106): icmp_seq=9 ttl=105 time=2.41 ms
^C
---
googleads.googleapis.com ping statistics ---
9 packets transmitted, 9 received, 0% packet loss, time 8011ms
rtt min/avg/max/mdev = 2.322/2.441/2.983/0.204 ms
sh-4.2$
```
- On our application, we tried to get the IP address of the domain by `InetAddress#getByName` method. We could resolve the domain, it means only the name resolve method in Client Library is facing trouble for resolving the domain name.
```
# The result of `InetAddress#getByName`
10:42:47:559 Host Address:142.250.196.106
# `InetAddress#
getHostAddress`
```
We are using Client Library like this.
```
<dependency>
<groupId>com.google.api-ads</groupId>
<artifactId>google-ads</artifactId>
<version>17.0.1</version>
</dependency>
```
```
# Create `googleAdsClient` and `op` (KeywordPlanOperation) before here
try (KeywordPlanServiceClient client = googleAdsClient.getLatestVersion().createKeywordPlanServiceClient()) {
// Adds the keyword plan.
MutateKeywordPlansResponse response
= client.mutateKeywordPlans(String.valueOf(customerId), Arrays.asList(op));
// Displays the results.
return response.getResults(0).getResourceName();
}
```
We want to know what configurations is lacked.
Thank you for sharing information.