在bigquery中插入行时没有与主机名关联的地址

在bigquery中插入行时没有与主机名关联的地址

本文介绍了java.net.UnknownHostException无法解析主机" accounts.google.com":在bigquery中插入行时没有与主机名关联的地址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好我正在开发Android应用程序,我在其中集成了BigQuery。我发现在BigQuery表中插入记录时,我们有时会遇到很多异常。我们不是这方面的专业知识,而是开始学习这项新技术。如果你们可以帮我解决这个问题,那就太好了。

  java.net.UnknownHostException:无法解析主机帐户。 google.com:在java.net.InetAddress.lookupHostByName(InetAddress.java:424)处没有与主机名
关联的地址(位于java.net.InetAddress.getAllByNameImpl(InetAddress.java:236)处)

at java.net.InetAddress.getAllByName(InetAddress.java:214)
at com.android.okhttp.internal.Dns $ 1.getAllByName(Dns.java:28)
at com.android。 okhttp.internal.http.RouteSelector.resetNextInetSocketAddress(RouteSelector.java:216)
at com.android.okhttp.internal.http.RouteSelector.next(RouteSelector.java:122)
at com.android。 okhttp.internal.http.HttpEngine.connect(HttpEngine.java:292)
at com.android.okhttp.internal.http.HttpEngine.sendSocketRequest(HttpEngine.java:255)
at com.android。 okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:206)
at com.android.okhttp.internal.http.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:345)
at com.android.okhttp.internal.http.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:89)
at com.android.okhttp.internal.http.HttpURLConnectionImpl.getOutputStream(HttpURLConnectionImpl.java:197)
at com.android.okhttp.internal.http.HttpsURLConnectionImpl.getOutputStream(HttpsURLConnectionImpl.java:254)
在com.google.aacaca(NetHttpRequest.java:77)
在com.google.aacrp(HttpRequest.java:972)
在com.google.aaaaha(TokenRequest.java:307)
在com.google.aabaabf(GoogleCredential.java:384)
在com.google.aaaach(Credential.java:489)
在com.google.aaaaca(Credential.java:217 )com.google.aacrp上的
(HttpRequest.java:859)com.google.aabdcc上的
(AbstractGoogleClientRequest.java:469)
at com.test.utils.cc(CommonUtility.java:2730)
at com.test.services.AppInstallIntentService.onHandleIntent(AppInstallIntentService.java:71)
at android.app.IntentService $ ServiceHandler.handleMessage (IntentService.java:65)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.os.HandlerThread.run(HandlerThread.java:61)
导致:libcore.io.GaiException:getaddrinfo失败:EAI_NODATA(没有与主机名关联的地址)
在libcore.io.Posix.getaddrinfo (Posix.java)
at libcore.io.ForwardingOs.getaddrinfo(ForwardingOs.java:61)
at java.net.InetAddress.lookupHostByName(InetAddress.java:405)
at java。 net.InetAddress.getAllByNameImpl(InetAddress.java:236)
at java.net.InetAddress.getAllByName(InetAddress.java:214)
at com.android.okhttp.internal.Dns $ 1.getAllByName( Dns.java:28)
at com.android.okhttp.internal.http.RouteSelector.resetNextInetSocketAddress(RouteSelector.java:216)
at com.android.okhttp.internal.http.RouteSelector.next( RouteSelector.java:122)
at com.android.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:292)
at com.android.okhttp.internal.http.HttpEngine.sendSocketRequest( HttpEngine.java:255)
at com.android.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:206)
at com.android.okhttp.internal.http.HttpURLConnectionImpl.execute( HttpURLConnectionImpl.java:345)
at com.android.okhttp.internal.http.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:89)
at com.android.okhttp.internal.http.HttpURLConnectionImpl.getOutputStream( HttpURLConnectionImpl.java:197)
at com.android.okhttp.internal.http.HttpsURLConnectionImpl.getOutputStream(HttpsURLConnectionImpl.java:254)
at com .google.aacaca(NetHttpRequest.java:77)
在com.google.aacrp(HttpRequest.java:972)
在com.google.aaaaha(TokenRequest.java:307)
at com.google.aabaabf(GoogleCredential.java:384)
在com.google.aaaach(Credential.java:489)
在com.google.aaaaca(Credential.java:217)
在com.google.aacrp(HttpRequest.java:859)
在com.google.aabdcc(AbstractGoogleClientRequest.java:469)
在com.test.utils.cc(CommonUtility.java:2730)$ b.b在com.test.services.AppInstallIntentService.onHandleIntent(AppInstallIntentService.java:71)
at android.app.IntentService $ ServiceHandler.handleMessage(IntentService.java:65)
at android.os。 Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.os.HandlerThread.run(HandlerThread.java:61)




这个例外是当你连接到一个有效的WiFi,但路由器没有收到互联网时也会引发。它非常容易重现:

连接到一个有效的wifi
现在,在路由器插入时从路由器上拔下电缆。



你会观察到这个错误!!



你无法真正解决这个问题,你只能优雅地通知用户。 (类似于无法建立连接)

也确保您在 AndroidManifest.xml

 < uses-permission android:name =android.permission.INTERNET/> 


Hi I am working on android app in which I have integrated BigQuery. I see we are getting a lot of exception sometimes while inserting records in BigQuery tables. We are not expertise in this but started to learn this new technology. It would be great if you guys can help me on this.

   java.net.UnknownHostException: Unable to resolve host "accounts.google.com": No address associated with hostname
          at java.net.InetAddress.lookupHostByName(InetAddress.java:424)
          at java.net.InetAddress.getAllByNameImpl(InetAddress.java:236)
          at java.net.InetAddress.getAllByName(InetAddress.java:214)
          at com.android.okhttp.internal.Dns$1.getAllByName(Dns.java:28)
          at com.android.okhttp.internal.http.RouteSelector.resetNextInetSocketAddress(RouteSelector.java:216)
          at com.android.okhttp.internal.http.RouteSelector.next(RouteSelector.java:122)
          at com.android.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:292)
          at com.android.okhttp.internal.http.HttpEngine.sendSocketRequest(HttpEngine.java:255)
          at com.android.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:206)
          at com.android.okhttp.internal.http.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:345)
          at com.android.okhttp.internal.http.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:89)
          at com.android.okhttp.internal.http.HttpURLConnectionImpl.getOutputStream(HttpURLConnectionImpl.java:197)
          at com.android.okhttp.internal.http.HttpsURLConnectionImpl.getOutputStream(HttpsURLConnectionImpl.java:254)
          at com.google.a.a.c.a.c.a(NetHttpRequest.java:77)
          at com.google.a.a.c.r.p(HttpRequest.java:972)
          at com.google.a.a.a.a.h.a(TokenRequest.java:307)
          at com.google.a.a.b.a.a.b.f(GoogleCredential.java:384)
          at com.google.a.a.a.a.c.h(Credential.java:489)
          at com.google.a.a.a.a.c.a(Credential.java:217)
          at com.google.a.a.c.r.p(HttpRequest.java:859)
          at com.google.a.a.b.d.c.c(AbstractGoogleClientRequest.java:469)
          at com.test.utils.c.c(CommonUtility.java:2730)
          at com.test.services.AppInstallIntentService.onHandleIntent(AppInstallIntentService.java:71)
          at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:65)
          at android.os.Handler.dispatchMessage(Handler.java:102)
          at android.os.Looper.loop(Looper.java:136)
          at android.os.HandlerThread.run(HandlerThread.java:61)
   Caused by: libcore.io.GaiException: getaddrinfo failed: EAI_NODATA (No address associated with hostname)
          at libcore.io.Posix.getaddrinfo(Posix.java)
          at libcore.io.ForwardingOs.getaddrinfo(ForwardingOs.java:61)
          at java.net.InetAddress.lookupHostByName(InetAddress.java:405)
          at java.net.InetAddress.getAllByNameImpl(InetAddress.java:236)
          at java.net.InetAddress.getAllByName(InetAddress.java:214)
          at com.android.okhttp.internal.Dns$1.getAllByName(Dns.java:28)
          at com.android.okhttp.internal.http.RouteSelector.resetNextInetSocketAddress(RouteSelector.java:216)
          at com.android.okhttp.internal.http.RouteSelector.next(RouteSelector.java:122)
          at com.android.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:292)
          at com.android.okhttp.internal.http.HttpEngine.sendSocketRequest(HttpEngine.java:255)
          at com.android.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:206)
          at com.android.okhttp.internal.http.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:345)
          at com.android.okhttp.internal.http.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:89)
          at com.android.okhttp.internal.http.HttpURLConnectionImpl.getOutputStream(HttpURLConnectionImpl.java:197)
          at com.android.okhttp.internal.http.HttpsURLConnectionImpl.getOutputStream(HttpsURLConnectionImpl.java:254)
          at com.google.a.a.c.a.c.a(NetHttpRequest.java:77)
          at com.google.a.a.c.r.p(HttpRequest.java:972)
          at com.google.a.a.a.a.h.a(TokenRequest.java:307)
          at com.google.a.a.b.a.a.b.f(GoogleCredential.java:384)
          at com.google.a.a.a.a.c.h(Credential.java:489)
          at com.google.a.a.a.a.c.a(Credential.java:217)
          at com.google.a.a.c.r.p(HttpRequest.java:859)
          at com.google.a.a.b.d.c.c(AbstractGoogleClientRequest.java:469)
          at com.test.utils.c.c(CommonUtility.java:2730)
          at com.test.services.AppInstallIntentService.onHandleIntent(AppInstallIntentService.java:71)
          at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:65)
          at android.os.Handler.dispatchMessage(Handler.java:102)
          at android.os.Looper.loop(Looper.java:136)
          at android.os.HandlerThread.run(HandlerThread.java:61)
解决方案

This Exception Thrown to indicate that the IP address of a host could not be determined.

This exception is also raised when you are connected to a valid wifi but router does not receive the internet. Its very easy to reproduce this:

Connect to a valid wifi Now remove the cable from the router while router is pluged-in

You will observe this error!!

You can't really solve this, You can only notify the user gracefully. (something like - "Unable to make a connection")

also make sure you have added the permission in AndroidManifest.xml.

<uses-permission android:name="android.permission.INTERNET" />

这篇关于java.net.UnknownHostException无法解析主机&quot; accounts.google.com&quot;:在bigquery中插入行时没有与主机名关联的地址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-04 15:43