获取oauth刷新令牌错误命中bigtable时发生未授权错误

u5i3ibmn  于 2021-06-07  发布在  Hbase
关注(0)|答案(0)|浏览(283)

我有一个应用程序,它使用bigtable hbase api使用服务帐户文件创建bigtable连接。这在本地和weblogic服务器上都可以正常工作。但是在通过api请求之后,我得到了以下错误-

io.grpc.StatusRuntimeException: UNAUTHENTICATED: Unexpected failure get auth token at com.google.api.client.http.HttpRequest.execute(HttpRequest.java:981)
at com.google.auth.oauth2.ServiceAccountCredentials.refreshAccessToken(ServiceAccountCredentials.java:365)
at com.google.cloud.bigtable.grpc.io.RefreshingOAuth2CredentialsInterceptor.refreshCredentials(RefreshingOAuth2CredentialsInterceptor.java:379)
at com.google.cloud.bigtable.grpc.io.RefreshingOAuth2CredentialsInterceptor.access$100(RefreshingOAuth2CredentialsInterceptor.java:60)
at com.google.cloud.bigtable.grpc.io.RefreshingOAuth2CredentialsInterceptor$2.call(RefreshingOAuth2CredentialsInterceptor.java:328)
at com.google.cloud.bigtable.grpc.io.RefreshingOAuth2CredentialsInterceptor$2.call(RefreshingOAuth2CredentialsInterceptor.java:325)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
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)>

我使用以下配置来创建连接-

Configuration config = BigtableConfiguration.configure(projectId,instanceId);
    config.set(BigtableOptionsFactory.BIGTABLE_SERVICE_ACCOUNT_JSON_KEYFILE_LOCATION_KEY, new File(filePath).toString());       

Connection btConnection=ConnectionFactory.createConnection(config);

//then the code to read and write into the table`...

这些代码有时工作得很好,在一些请求之后会抛出上面的错误。我需要说明为什么会发生这种情况,以及如何解决它,以便在发送批量请求时应用程序能够正常工作。我认为问题可能是访问刷新令牌,但我如何解决它?

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题