从Google云端存储中读取时出错

时间:2016-04-06 10:17:24

标签: google-app-engine google-cloud-storage

我尝试从云存储中读取文件时遇到"Unexpected cause of ExecutionException"错误。以下是完整的堆栈跟踪。

文件大小为20MB。

  

com.google.appengine.tools.cloudstorage.NonRetriableException:   了java.lang.RuntimeException:   com.google.appengine.tools.cloudstorage.SimpleGcsInputChannelImpl$1@ef713e:   ExecutionException的意外原因         在com.google.appengine.tools.cloudstorage.RetryHelper.doRetry(RetryHelper.java:120)         在com.google.appengine.tools.cloudstorage.RetryHelper.runWithRetries(RetryHelper.java:166)         在com.google.appengine.tools.cloudstorage.RetryHelper.runWithRetries(RetryHelper.java:156)         在com.google.appengine.tools.cloudstorage.SimpleGcsInputChannelImpl.read(SimpleGcsInputChannelImpl.java:84)         在DownloadAttachment.doGet(DownloadAttachment.java:194)         在javax.servlet.http.HttpServlet.service(HttpServlet.java:617)         在javax.servlet.http.HttpServlet.service(HttpServlet.java:717)         在com.google.inject.servlet.ServletDefinition.doService(ServletDefinition.java:263)         在com.google.inject.servlet.ServletDefinition.service(ServletDefinition.java:178)         在com.google.inject.servlet.ManagedServletPipeline.service(ManagedServletPipeline.java:91)         在com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:62)         at com.pw.budgeting.integration.SynchronizationMessageFilter.doFilter(SynchronizationMessageFilter.java:34)         在com.google.inject.servlet.FilterDefinition.doFilter(FilterDefinition.java:163)         在com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:58)         在com.google.inject.servlet.FilterDefinition.doFilter(FilterDefinition.java:168)         在com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:58)         在com.google.inject.servlet.FilterDefinition.doFilter(FilterDefinition.java:168)         在com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:58)         在com.google.inject.servlet.FilterDefinition.doFilter(FilterDefinition.java:168)         在com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:58)         在com.google.inject.servlet.FilterDefinition.doFilter(FilterDefinition.java:168)         在com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:58)         在com.google.inject.servlet.FilterDefinition.doFilter(FilterDefinition.java:168)         在com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:58)         在com.google.inject.servlet.FilterDefinition.doFilter(FilterDefinition.java:168)         在com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:58)         在com.google.inject.servlet.FilterDefinition.doFilter(FilterDefinition.java:168)         在com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:58)         在com.google.inject.servlet.FilterDefinition.doFilter(FilterDefinition.java:168)         在com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:58)         在com.google.inject.servlet.FilterDefinition.doFilter(FilterDefinition.java:168)         在com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:58)         在com.google.inject.servlet.FilterDefinition.doFilter(FilterDefinition.java:168)         在com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:58)         在com.google.inject.servlet.FilterDefinition.doFilter(FilterDefinition.java:168)         在com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:58)         在com.google.inject.servlet.FilterDefinition.doFilter(FilterDefinition.java:168)         在com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:58)         at com.pw.features.FeatureFilter.doFilter(FeatureFilter.java:39)         在com.google.inject.servlet.FilterDefinition.doFilter(FilterDefinition.java:163)         在com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:58)         在com.pw.security.AuthenticationFilter.doFilter(AuthenticationFilter.java:43)         在com.google.inject.servlet.FilterDefinition.doFilter(FilterDefinition.java:163)         在com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:58)         在com.pw.security.SchemaFilter.doFilter(SchemaFilter.java:36)         在com.google.inject.servlet.FilterDefinition.doFilter(FilterDefinition.java:163)         在com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:58)         在com.google.inject.servlet.ManagedFilterPipeline.dispatch(ManagedFilterPipeline.java:118)         在com.google.inject.servlet.GuiceFilter.doFilter(GuiceFilter.java:113)         在org.mortbay.jetty.servlet.ServletHandler $ CachedChain.doFilter(ServletHandler.java:1157)         在com.google.apphosting.utils.servlet.ParseBlobUploadFilter.doFilter(ParseBlobUploadFilter.java:125)         在org.mortbay.jetty.servlet.ServletHandler $ CachedChain.doFilter(ServletHandler.java:1157)         在com.google.apphosting.runtime.jetty.SaveSessionFilter.doFilter(SaveSessionFilter.java:37)         在org.mortbay.jetty.servlet.ServletHandler $ CachedChain.doFilter(ServletHandler.java:1157)         在com.google.apphosting.utils.servlet.JdbcMySqlConnectionCleanupFilter.doFilter(JdbcMySqlConnectionCleanupFilter.java:60)         在org.mortbay.jetty.servlet.ServletHandler $ CachedChain.doFilter(ServletHandler.java:1157)         在com.google.apphosting.utils.servlet.TransactionCleanupFilter.doFilter(TransactionCleanupFilter.java:50)         在org.mortbay.jetty.servlet.ServletHandler $ CachedChain.doFilter(ServletHandler.java:1157)         在org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:388)         在org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)         在org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)         在org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)         在org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:418)         在com.google.apphosting.runtime.jetty.AppVersionHandlerMap.handle(AppVersionHandlerMap.java:260)         在org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)         在org.mortbay.jetty.Server.handle(Server.java:326)         在org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)         at org.mortbay.jetty.HttpConnection $ RequestHandler.headerComplete(HttpConnection.java:923)         在com.google.apphosting.runtime.jetty.RpcRequestParser.parseAvailable(RpcRequestParser.java:78)         在org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)         在com.google.apphosting.runtime.jetty.JettyServletEngineAdapter.serviceRequest(JettyServletEngineAdapter.java:148)         在com.google.apphosting.runtime.JavaRuntime $ RequestRunnable.run(JavaRuntime.java:468)         在com.google.tracing.TraceContext $ TraceContextRunnable.runInContext(TraceContext.java:437)         在com.google.tracing.TraceContext $ TraceContextRunnable $ 1.run(TraceContext.java:444)         在com.google.tracing.CurrentContext.runInContext(CurrentContext.java:256)         在com.google.tracing.TraceContext $ AbstractTraceContextCallback.runInInheritedContextNoUnref(TraceContext.java:308)         在com.google.tracing.TraceContext $ AbstractTraceContextCallback.runInInheritedContext(TraceContext.java:300)         在com.google.tracing.TraceContext $ TraceContextRunnable.run(TraceContext.java:441)         在com.google.apphosting.runtime.ThreadGroupPool $ PoolEntry.run(ThreadGroupPool.java:235)         在java.lang.Thread.run(Thread.java:745)       引起:java.lang.RuntimeException:com.google.appengine.tools.cloudstorage.SimpleGcsInputChannelImpl$1@ef713e:   ExecutionException的意外原因         在com.google.appengine.tools.cloudstorage.SimpleGcsInputChannelImpl $ 1.call(SimpleGcsInputChannelImpl.java:105)         在com.google.appengine.tools.cloudstorage.SimpleGcsInputChannelImpl $ 1.call(SimpleGcsInputChannelImpl.java:84)         在com.google.appengine.tools.cloudstorage.RetryHelper.doRetry(RetryHelper.java:108)         ......还有82个       原因:com.google.apphosting.api.ApiProxy $ UnknownException:API请求urlfetch.Fetch()发生错误。         在com.google.apphosting.runtime.ApiProxyImpl.statusException(ApiProxyImpl.java:650)         在com.google.apphosting.runtime.ApiProxyImpl $ AsyncApiFuture.setRpcError(ApiProxyImpl.java:603)         在com.google.apphosting.runtime.ApiProxyImpl $ AsyncApiFuture.failure(ApiProxyImpl.java:591)         在com.google.apphosting.runtime.stubby.StubbyCallbackAdapter.failure(StubbyCallbackAdapter.java:25)         在com.google.net.rpc3.client.RpcStub $ RpcCallbackDispatcher $ 1.runInContext(RpcStub.java:864)         在com.google.tracing.TraceContext $ TraceContextRunnable $ 1.run(TraceContext.java:444)         在com.google.tracing.CurrentContext.runInContext(CurrentContext.java:256)         在com.google.tracing.TraceContext $ AbstractTraceContextCallback.runInInheritedContextNoUnref(TraceContext.java:308)         在com.google.tracing.TraceContext $ AbstractTraceContextCallback.runInInheritedContext(TraceContext.java:300)         在com.google.tracing.TraceContext $ TraceContextRunnable.run(TraceContext.java:441)         在com.google.net.rpc3.client.RpcStub $ RpcCallbackDispatcher.runCallback(RpcStub.java:900)         在com.google.net.rpc3.client.RpcStub $ RpcCallbackDispatcher.rpcFinished(RpcStub.java:910)         在com.google.net.rpc3.client.RpcStub $ RpcCallbackDispatcher.failure(RpcStub.java:895)         在com.google.net.rpc3.impl.client.RpcClientInternalContext.runCallbacks(RpcClientInternalContext.java:1229)         在com.google.net.rpc3.impl.client.RpcClientInternalContext.finishRpcAndNotifyApp(RpcClientInternalContext.java:1126)         在com.google.net.rpc3.impl.client.RpcNetChannel.afterFinishingActiveRpc(RpcNetChannel.java:1557)         在com.google.net.rpc3.impl.client.RpcNetChannel.finishRpc(RpcNetChannel.java:1377)         在com.google.net.rpc3.impl.client.RpcNetChannel.handleResponse(RpcNetChannel.java:3139)         在com.google.net.rpc3.impl.client.RpcNetChannel.messageReceived(RpcNetChannel.java:2875)         在com.google.net.rpc3.impl.client.RpcNetChannel.access 2900美元(RpcNetChannel.java:179)         在com.google.net.rpc3.impl.client.RpcNetChannel $ TransportCallback.receivedMessage(RpcNetChannel.java:4081)         在com.google.net.rpc3.impl.client.RpcChannelTransportData $ TransportCallback.receivedMessage(RpcChannelTransportData.java:669)         在com.google.net.rpc3.impl.wire.RpcBaseTransport.receivedMessage(RpcBaseTransport.java:457)         在com.google.apphosting.runtime.udrpc.UdrpcTransport $ ClientAdapter.receivedMessage(UdrpcTransport.java:338)         在com.google.apphosting.runtime.udrpc.UdrpcTransport.dispatchPacket(UdrpcTransport.java:187)         在com.google.apphosting.runtime.udrpc.AbstractUdrpcTransport.readPackets(AbstractUdrpcTransport.java:202)         在com.google.apphosting.runtime.udrpc.AbstractUdrpcTransport.access $ 000(AbstractUdrpcTransport.java:30)         在com.google.apphosting.runtime.udrpc.AbstractUdrpcTransport $ 1.run(AbstractUdrpcTransport.java:57)         在com.google.net.eventmanager.AbstractFutureTask $ Sync.innerRun(AbstractFutureTask.java:260)         在com.google.net.eventmanager.AbstractFutureTask.run(AbstractFutureTask.java:121)         在com.google.net.eventmanager.EventManagerImpl.runTask(EventManagerImpl.java:594)         在com.google.net.eventmanager.EventManagerImpl.internalRunWorkerLoop(EventManagerImpl.java:1012)         在com.google.net.eventmanager.EventManagerImpl.runWorkerLoop(EventManagerImpl.java:892)         在com.google.net.eventmanager.WorkerThreadInfo.runWorkerLoop(WorkerThreadInfo.java:161)         在com.google.net.eventmanager.EventManagerImpl $ WorkerThread.run(EventManagerImpl.java:1877)



我的代码是:

GcsFilename keyAsAFileName = new GcsFilename(contentBucketName, key);
GcsFileMetadata gcsFileMetadata = gcsService.getMetadata(keyAsAFileName);
            ByteBuffer result = null;
            if (gcsFileMetadata != null) {
                result = ByteBuffer.allocate((int)gcsFileMetadata.getLength());
                if(gcsFileMetadata.getLength()>0){
                    readChannel = gcsService.openReadChannel(keyAsAFileName, 0);
                    readChannel.read(result);
                }
            }

请帮忙。

1 个答案:

答案 0 :(得分:0)

此失败的根本原因似乎是基础HTTP传输失败:“由以下原因引起:com.google.apphosting.api.ApiProxy $ UnknownException:API请求发生错误urlfetch.Fetch()”< / p>

同样的失败是继续发生还是零星?

另外,了解更多关于它的运行方式可以提供帮助(AE经典,如果是,instance type,App Engine灵活(JavaCustom runtime)?