google-oauthgoogle-bigquerygcloud-java

com.google.gcloud.bigquery.BigQueryException: Error getting access token for service account:


I am having a program will involves frequently accessing BigQuery using com.google.gcloud:gcloudjava:0.1.4 with default BigQueryOptions configuration

However sometime I am getting error with stacktrace as follows

    Caused by: java.io.IOException: Error getting access token for service account:
    at com.google.auth.oauth2.ServiceAccountCredentials.refreshAccessToken(ServiceAccountCredentials.java:227)
    at com.google.auth.oauth2.OAuth2Credentials.refresh(OAuth2Credentials.java:97)
    at com.google.auth.oauth2.OAuth2Credentials.getRequestMetadata(OAuth2Credentials.java:74)
    at com.google.auth.http.HttpCredentialsAdapter.initialize(HttpCredentialsAdapter.java:65)
    at com.google.gcloud.ServiceOptions$1.initialize(ServiceOptions.java:533)
    at com.google.api.client.http.HttpRequestFactory.buildRequest(HttpRequestFactory.java:93)
    at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.buildHttpRequest(AbstractGoogleClientRequest.java:300)
    at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:419)
    at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:352)
    at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.execute(AbstractGoogleClientRequest.java:469)
    at com.google.gcloud.spi.DefaultBigQueryRpc.query(DefaultBigQueryRpc.java:402)

It only failed from time to time, but I am wondering whether there is any way that I could sort of improve the stability of my program. Therefore just in case I am wondering, it is a pure server side problem that I have no way to do about it or is there any way that I could at client side to potentially decrease the possibility of this happening (say by changing the authentication configuration or anything?)


Solution

  • May be a server side problem with google-oauth. I'm having problems with that as well - services that used to work fine can't get an access token anymore (since about 1h).