Google Storage API:无法获取访问令牌

时间:2017-07-28 05:51:25

标签: java google-app-engine servlets

我正在尝试将Google应用引擎标准环境应用程序迁移到google endpoints 2.0,我在本地开发服务器测试中面临以下问题:

我使用的是GAE SDK版本1.9.54和端点框架版本2.0.7,以及端点管理版本1.0.4。 google-cloud-storage 1.2.0

我已经设置了应用程序默认凭据:

gcloud auth application-default login

[INFO] GCLOUD: SEVERE: exception occurred while calling backend method
**[INFO] GCLOUD: com.google.cloud.storage.StorageException: Could not get the access token.**
[INFO] GCLOUD:  at com.google.cloud.storage.spi.v1.HttpStorageRpc.translate(HttpStorageRpc.java:189)
[INFO] GCLOUD:  at com.google.cloud.storage.spi.v1.HttpStorageRpc.get(HttpStorageRpc.java:335)
[INFO] GCLOUD:  at com.google.cloud.storage.StorageImpl$5.call(StorageImpl.java:191)
[INFO] GCLOUD:  at com.google.cloud.storage.StorageImpl$5.call(StorageImpl.java:188)
[INFO] GCLOUD:  at com.google.api.gax.retrying.DirectRetryingExecutor.submit(DirectRetryingExecutor.java:93)
[INFO] GCLOUD:  at com.google.cloud.RetryHelper.runWithRetries(RetryHelper.java:49)
[INFO] GCLOUD:  at com.google.cloud.storage.StorageImpl.get(StorageImpl.java:188)
[INFO] GCLOUD:  at com.google.cloud.storage.StorageImpl.get(StorageImpl.java:180)

... 我的代码 ....

[INFO] GCLOUD:  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[INFO] GCLOUD:  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[INFO] GCLOUD:  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[INFO] GCLOUD:  at java.lang.reflect.Method.invoke(Method.java:498)
[INFO] GCLOUD:  at com.google.appengine.tools.development.agent.runtime.Runtime.invoke(Runtime.java:128)
[INFO] GCLOUD:  at com.google.api.server.spi.SystemService.invokeServiceMethod(SystemService.java:351)
[INFO] GCLOUD:  at com.google.api.server.spi.handlers.EndpointsMethodHandler$RestHandler.handle(EndpointsMethodHandler.java:119)
[INFO] GCLOUD:  at com.google.api.server.spi.handlers.EndpointsMethodHandler$RestHandler.handle(EndpointsMethodHandler.java:102)
[INFO] GCLOUD:  at com.google.api.server.spi.dispatcher.PathDispatcher.dispatch(PathDispatcher.java:49)
[INFO] GCLOUD:  at com.google.api.server.spi.EndpointsServlet.service(EndpointsServlet.java:71)
[INFO] GCLOUD:  at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
[INFO] GCLOUD:  at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
[INFO] GCLOUD:  at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1166)
[INFO] GCLOUD:  at com.slb.swt.data.oauth.AuthenticationFilter.doFilter(AuthenticationFilter.java:26)
[INFO] GCLOUD:  at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
[INFO] GCLOUD:  at com.google.appengine.api.socket.dev.DevSocketFilter.doFilter(DevSocketFilter.java:74)
[INFO] GCLOUD:  at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
[INFO] GCLOUD:  at com.google.appengine.tools.development.ResponseRewriterFilter.doFilter(ResponseRewriterFilter.java:134)
[INFO] GCLOUD:  at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
[INFO] GCLOUD:  at com.google.appengine.tools.development.HeaderVerificationFilter.doFilter(HeaderVerificationFilter.java:34)
[INFO] GCLOUD:  at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
[INFO] GCLOUD:  at com.google.appengine.api.blobstore.dev.ServeBlobFilter.doFilter(ServeBlobFilter.java:63)
[INFO] GCLOUD:  at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
[INFO] GCLOUD:  at com.google.apphosting.utils.servlet.TransactionCleanupFilter.doFilter(TransactionCleanupFilter.java:48)
[INFO] GCLOUD:  at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
[INFO] GCLOUD:  at com.google.appengine.tools.development.StaticFileFilter.doFilter(StaticFileFilter.java:122)
[INFO] GCLOUD:  at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
[INFO] GCLOUD:  at com.google.appengine.tools.development.DevAppServerModulesFilter.doDirectRequest(DevAppServerModulesFilter.java:366)
[INFO] GCLOUD:  at com.google.appengine.tools.development.DevAppServerModulesFilter.doDirectModuleRequest(DevAppServerModulesFilter.java:349)
[INFO] GCLOUD:  at com.google.appengine.tools.development.DevAppServerModulesFilter.doFilter(DevAppServerModulesFilter.java:116)
[INFO] GCLOUD:  at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
[INFO] GCLOUD:  at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:388)
[INFO] GCLOUD:  at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
[INFO] GCLOUD:  at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
[INFO] GCLOUD:  at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
[INFO] GCLOUD:  at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:418)
[INFO] GCLOUD:  at com.google.appengine.tools.development.DevAppEngineWebAppContext.handle(DevAppEngineWebAppContext.java:95)
[INFO] GCLOUD:  at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
[INFO] GCLOUD:  at com.google.appengine.tools.development.JettyContainerService$ApiProxyHandler.handle(JettyContainerService.java:508)
[INFO] GCLOUD:  at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
[INFO] GCLOUD:  at org.mortbay.jetty.Server.handle(Server.java:326)
[INFO] GCLOUD:  at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
[INFO] GCLOUD:  at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:938)
[INFO] GCLOUD:  at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:755)
[INFO] GCLOUD:  at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:218)
[INFO] GCLOUD:  at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
[INFO] GCLOUD:  at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409)
[INFO] GCLOUD:  at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)
[INFO] GCLOUD: Caused by: java.io.IOException: Could not get the access token.
[INFO] GCLOUD:  at com.google.auth.oauth2.AppEngineCredentials.refreshAccessToken(AppEngineCredentials.java:136)
[INFO] GCLOUD:  at com.google.auth.oauth2.OAuth2Credentials.refresh(OAuth2Credentials.java:149)
[INFO] GCLOUD:  at com.google.auth.oauth2.OAuth2Credentials.getRequestMetadata(OAuth2Credentials.java:135)
[INFO] GCLOUD:  at com.google.auth.http.HttpCredentialsAdapter.initialize(HttpCredentialsAdapter.java:96)
[INFO] GCLOUD:  at com.google.cloud.http.HttpTransportOptions$1.initialize(HttpTransportOptions.java:156)
[INFO] GCLOUD:  at com.google.api.client.http.HttpRequestFactory.buildRequest(HttpRequestFactory.java:93)
[INFO] GCLOUD:  at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.buildHttpRequest(AbstractGoogleClientRequest.java:300)
[INFO] GCLOUD:  at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:419)
[INFO] GCLOUD:  at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:352)
[INFO] GCLOUD:  at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.execute(AbstractGoogleClientRequest.java:469)
[INFO] GCLOUD:  at com.google.cloud.storage.spi.v1.HttpStorageRpc.get(HttpStorageRpc.java:333)
[INFO] GCLOUD:  ... 57 more
[INFO] GCLOUD: Caused by: java.lang.reflect.InvocationTargetException
[INFO] GCLOUD:  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[INFO] GCLOUD:  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[INFO] GCLOUD:  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[INFO] GCLOUD:  at java.lang.reflect.Method.invoke(Method.java:498)
[INFO] GCLOUD:  at com.google.appengine.tools.development.agent.runtime.Runtime.invoke(Runtime.java:128)
[INFO] GCLOUD:  at com.google.auth.oauth2.AppEngineCredentials.refreshAccessToken(AppEngineCredentials.java:131)
[INFO] GCLOUD:  ... 67 more
[INFO] GCLOUD: Caused by: java.lang.IllegalAccessError: com/google/appengine/repackaged/com/google/common/base/Platform
[INFO] GCLOUD:  at com.google.appengine.repackaged.com.google.common.base.Ticker$1.read(Ticker.java:69)
[INFO] GCLOUD:  at com.google.appengine.repackaged.com.google.common.base.Stopwatch.elapsedNanos(Stopwatch.java:181)
[INFO] GCLOUD:  at com.google.appengine.repackaged.com.google.common.base.Stopwatch.elapsed(Stopwatch.java:194)
[INFO] GCLOUD:  at com.google.appengine.repackaged.com.google.common.cache.LocalCache$LoadingValueReference.elapsedNanos(LocalCache.java:3665)
[INFO] GCLOUD:  at com.google.appengine.repackaged.com.google.common.cache.LocalCache$Segment.getAndRecordStats(LocalCache.java:2381)
[INFO] GCLOUD:  at com.google.appengine.repackaged.com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2336)
[INFO] GCLOUD:  at com.google.appengine.repackaged.com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2294)
[INFO] GCLOUD:  at com.google.appengine.repackaged.com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2207)
[INFO] GCLOUD:  at com.google.appengine.repackaged.com.google.common.cache.LocalCache.get(LocalCache.java:4062)
[INFO] GCLOUD:  at com.google.appengine.repackaged.com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:4066)
[INFO] GCLOUD:  at com.google.appengine.repackaged.com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:4995)
[INFO] GCLOUD:  at com.google.appengine.repackaged.com.google.common.cache.LocalCache$LocalLoadingCache.getUnchecked(LocalCache.java:5001)
[INFO] GCLOUD:  at com.google.appengine.api.appidentity.AppIdentityServiceImpl.getAccessToken(AppIdentityServiceImpl.java:272)
[INFO] GCLOUD:  ... 73 more
[INFO] GCLOUD:

0 个答案:

没有答案