简体   繁体   English

ApplicationError:使用App Engine中的Java远程API将文件发送到Google Cloud Storage时出现10

[英]ApplicationError: 10 on sending files to Google Cloud Storage using the Java remote API from App Engine

I'm trying to migrate my old blobs from the Blobstore to the Could Storage, using the remote API to avoid nasty timeouts. 我正在尝试使用远程API将旧的Blob从Blobstore迁移到Could Storage,以避免讨厌的超时。 But I'm stuck with the ApplicationError: 10 every time I close the GcsOutputChannel - with no uploaded files in the end. 但是,每次关闭GcsOutputChannel时,我GcsOutputChannel ApplicationError: 10GcsOutputChannel -最终没有上传的文件。

My code: 我的代码:

//using the deprecated API to read the BlobStore:
FileService fileService = FileServiceFactory.getFileService();
AppEngineFile blobFile = fileService.getBlobFile(new BlobKey("myBlobKeyReadFromDatastore"));
FileReadChannel readChannel = fileService.openReadChannel(blobFile, false);
InputStream is = Channels.newInputStream(readChannel);

//now using the brand new API to write to the GCS:
GcsService gcsService = GcsServiceFactory.createGcsService();
GcsFilename filename = new GcsFilename("MyBucket", "theNameOfTheFileReadFromDatastore");
GcsFileOptions options = new GcsFileOptions.Builder().mimeType("theMimeTypeReadFromDatastore").build();
GcsOutputChannel writeChannel = gcsService.createOrReplace(filename, options);
OutputStream os = Channels.newOutputStream(writeChannel);

//and some reading -> writing...                
byte[] buff = new byte[1024 * 1024];
int read = 0;
while ((read = is.read(buff)) >= 0){
    os.write(buff, 0, read);
}
writeChannel.close(); //<-- Exception here!
readChannel.close();                    

The stacktrace: 堆栈跟踪:

com.google.appengine.tools.cloudstorage.RetriesExhaustedException: RetryHelper(13.39 s, 6 attempts, com.google.appengine.tools.cloudstorage.GcsOutputChannelImpl$1@ddbef51): Too many failures, giving up
com.google.appengine.tools.cloudstorage.RetriesExhaustedException: RetryHelper(13.39 s, 6 attempts, com.google.appengine.tools.cloudstorage.GcsOutputChannelImpl$1@ddbef51): Too many failures, giving up
    at com.google.appengine.tools.cloudstorage.RetryHelper.doRetry(RetryHelper.java:115)
    at com.google.appengine.tools.cloudstorage.RetryHelper.runWithRetries(RetryHelper.java:138)
    at com.google.appengine.tools.cloudstorage.GcsOutputChannelImpl.close(GcsOutputChannelImpl.java:140)
Caused by: java.io.IOException
    at com.google.appengine.api.files.FileServiceImpl.translateException(FileServiceImpl.java:620)
    at com.google.appengine.api.files.FileServiceImpl.makeSyncCall(FileServiceImpl.java:593)
    at com.google.appengine.api.files.FileServiceImpl.close(FileServiceImpl.java:564)
    at com.google.appengine.api.files.FileServiceImpl.close(FileServiceImpl.java:456)
    at com.google.appengine.api.files.FileWriteChannelImpl.close(FileWriteChannelImpl.java:81)
    at com.google.appengine.tools.cloudstorage.dev.LocalRawGcsService.append(LocalRawGcsService.java:159)
    at com.google.appengine.tools.cloudstorage.dev.LocalRawGcsService.finishObjectCreation(LocalRawGcsService.java:178)
    at com.google.appengine.tools.cloudstorage.GcsOutputChannelImpl$1.run(GcsOutputChannelImpl.java:143)
    at com.google.appengine.tools.cloudstorage.GcsOutputChannelImpl$1.run(GcsOutputChannelImpl.java:140)
    at com.google.appengine.tools.cloudstorage.RetryHelper.doRetry(RetryHelper.java:93)
    ... 5 more
Caused by: com.google.apphosting.api.ApiProxy$ApplicationException: ApplicationError: 10: 
    at java.lang.Thread.getStackTrace(Thread.java:1567)
    at com.google.apphosting.runtime.ApiProxyImpl.doSyncCall(ApiProxyImpl.java:259)
    at com.google.apphosting.runtime.ApiProxyImpl.access$000(ApiProxyImpl.java:68)
    at com.google.apphosting.runtime.ApiProxyImpl$1.run(ApiProxyImpl.java:202)
    at com.google.apphosting.runtime.ApiProxyImpl$1.run(ApiProxyImpl.java:199)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.google.apphosting.runtime.ApiProxyImpl.makeSyncCall(ApiProxyImpl.java:199)
    at com.google.apphosting.runtime.ApiProxyImpl.makeSyncCall(ApiProxyImpl.java:68)
    at com.google.apphosting.api.ApiProxy.makeSyncCall(ApiProxy.java:107)
    at com.google.apphosting.api.ApiProxy.makeSyncCall(ApiProxy.java:56)
    at com.google.apphosting.utils.remoteapi.RemoteApiServlet.executeRequest(RemoteApiServlet.java:384)
    at com.google.apphosting.utils.remoteapi.RemoteApiServlet.doPost(RemoteApiServlet.java:183)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1166)
    at com.google.apphosting.utils.servlet.ParseBlobUploadFilter.doFilter(ParseBlobUploadFilter.java:125)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
    at com.google.apphosting.runtime.jetty.SaveSessionFilter.doFilter(SaveSessionFilter.java:35)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
    at com.google.apphosting.utils.servlet.TransactionCleanupFilter.doFilter(TransactionCleanupFilter.java:43)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
    at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:388)
    at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
    at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
    at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
    at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:418)
    at com.google.apphosting.runtime.jetty.AppVersionHandlerMap.handle(AppVersionHandlerMap.java:266)
    at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
    at org.mortbay.jetty.Server.handle(Server.java:326)
    at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
    at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:923)
    at com.google.apphosting.runtime.jetty.RpcRequestParser.parseAvailable(RpcRequestParser.java:76)
    at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
    at com.google.apphosting.runtime.jetty.JettyServletEngineAdapter.serviceRequest(JettyServletEngineAdapter.java:146)
    at com.google.apphosting.runtime.JavaRuntime$RequestRunnable.run(JavaRuntime.java:439)
    at com.google.tracing.TraceContext$TraceContextRunnable.runInContext(TraceContext.java:435)
    at com.google.tracing.TraceContext$TraceContextRunnable$1.run(TraceContext.java:442)
    at com.google.tracing.CurrentContext.runInContext(CurrentContext.java:186)
    at com.google.tracing.TraceContext$AbstractTraceContextCallback.runInInheritedContextNoUnref(TraceContext.java:306)
    at com.google.tracing.TraceContext$AbstractTraceContextCallback.runInInheritedContext(TraceContext.java:298)
    at com.google.tracing.TraceContext$TraceContextRunnable.run(TraceContext.java:439)
    at com.google.apphosting.runtime.ThreadGroupPool$PoolEntry.run(ThreadGroupPool.java:251)
    at java.lang.Thread.run(Thread.java:722)
Caused by: com.google.apphosting.api.ApiProxy$ApplicationException: ApplicationError: 10: 
    at com.google.apphosting.utils.runtime.ApiProxyUtils.convertApiResponseRpcErrorToException(ApiProxyUtils.java:108)
    at com.google.apphosting.utils.runtime.ApiProxyUtils.convertApiError(ApiProxyUtils.java:70)
    at com.google.apphosting.runtime.ApiProxyImpl$AsyncApiFuture.success(ApiProxyImpl.java:493)
    at com.google.apphosting.runtime.ApiProxyImpl$AsyncApiFuture.success(ApiProxyImpl.java:411)
    at com.google.net.rpc3.client.RpcStub$RpcCallbackDispatcher$1.runInContext(RpcStub.java:811)
    at com.google.tracing.TraceContext$TraceContextRunnable$1.run(TraceContext.java:442)
    at com.google.tracing.CurrentContext.runInContext(CurrentContext.java:186)
    at com.google.tracing.TraceContext$AbstractTraceContextCallback.runInInheritedContextNoUnref(TraceContext.java:306)
    at com.google.tracing.TraceContext$AbstractTraceContextCallback.runInInheritedContext(TraceContext.java:298)
    at com.google.tracing.TraceContext$TraceContextRunnable.run(TraceContext.java:439)
    at com.google.net.rpc3.client.RpcStub$RpcCallbackDispatcher.runCallback(RpcStub.java:849)
    at com.google.net.rpc3.client.RpcStub$RpcCallbackDispatcher.rpcFinished(RpcStub.java:859)
    at com.google.net.rpc3.client.RpcStub$RpcCallbackDispatcher.success(RpcStub.java:838)
    at com.google.net.rpc3.impl.client.RpcClientInternalContext.runCallbacks(RpcClientInternalContext.java:984)
    at com.google.net.rpc3.impl.client.RpcClientInternalContext.finishRpcAndNotifyApp(RpcClientInternalContext.java:889)
    at com.google.net.rpc3.impl.client.RpcNetChannel.afterFinishingActiveRpc(RpcNetChannel.java:1291)
    at com.google.net.rpc3.impl.client.RpcNetChannel.finishRpc(RpcNetChannel.java:1124)
    at com.google.net.rpc3.impl.client.RpcNetChannel.handleResponse(RpcNetChannel.java:2690)
    at com.google.net.rpc3.impl.client.RpcNetChannel.messageReceived(RpcNetChannel.java:2433)
    at com.google.net.rpc3.impl.client.RpcNetChannel.access$2300(RpcNetChannel.java:159)
    at com.google.net.rpc3.impl.client.RpcNetChannel$TransportCallback.receivedMessage(RpcNetChannel.java:3605)
    at com.google.net.rpc3.impl.client.RpcChannelTransportData$TransportCallback.receivedMessage(RpcChannelTransportData.java:640)
    at com.google.net.rpc3.impl.wire.RpcBaseTransport.receivedMessage(RpcBaseTransport.java:444)
    at com.google.apphosting.runtime.udrpc.UdrpcTransport$ClientAdapter.receivedMessage(UdrpcTransport.java:567)
    at com.google.apphosting.runtime.udrpc.UdrpcTransport.dispatchPacket(UdrpcTransport.java:386)
    at com.google.apphosting.runtime.udrpc.UdrpcTransport.access$500(UdrpcTransport.java:63)
    at com.google.apphosting.runtime.udrpc.UdrpcTransport$5.run(UdrpcTransport.java:286)
    at com.google.net.eventmanager.AbstractFutureTask$Sync.innerRun(AbstractFutureTask.java:260)
    at com.google.net.eventmanager.AbstractFutureTask.run(AbstractFutureTask.java:121)
    at com.google.net.eventmanager.EventManagerImpl.runTask(EventManagerImpl.java:579)
    at com.google.net.eventmanager.EventManagerImpl.internalRunWorkerLoop(EventManagerImpl.java:994)
    at com.google.net.eventmanager.EventManagerImpl.runWorkerLoop(EventManagerImpl.java:876)
    at com.google.net.eventmanager.WorkerThreadInfo.runWorkerLoop(WorkerThreadInfo.java:160)
    at com.google.net.eventmanager.EventManagerImpl$WorkerThread.run(EventManagerImpl.java:1849)

The error occurs even with files with less than 1KB in size. 即使文件大小小于1KB,也会发生此错误。 My Google Cloud Storage is configured with the user <my-app-id>@appspot.gserviceaccount.com as owner of the bucket and as "can edit" in the project. 使用用户<my-app-id>@appspot.gserviceaccount.com将我的Google Cloud Storage配置为存储桶的所有者,并在项目中“可以编辑”。 The Billing is enabled as well (both in App Engine and in the Google Cloud Console). 帐单也已启用(在App Engine和Google Cloud Console中均已启用)。 I'm using the App Engine SDK 1.8.3. 我正在使用App Engine SDK 1.8.3。

I don't know what to do. 我不知道该怎么办。 Any ideas? 有任何想法吗?

This was a bug. 这是一个错误。 It was fixed in this change: https://code.google.com/p/appengine-gcs-client/source/detail?r=104 Sync to the latest version in the SVN and it should go away. 此更改已修复: https : //code.google.com/p/appengine-gcs-client/source/detail? r = 104同步到SVN中的最新版本,应该会消失。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用blobstore api从云存储中检索文件的Google App引擎Java错误 - google app engine java error using blobstore api to retrieve file from cloud storage 使用 Java 通过 Google App Engine 将文件上传到 Google Cloud Storage:(没有这样的文件或目录) - Uploading Files to Google Cloud Storage via Google App Engine using Java: (No such file or directory) 在Google云端存储中创建API访问后,ApiProxy $ ApplicationException:ApplicationError:8 - ApiProxy$ApplicationException: ApplicationError: 8 after created the API Access in google Cloud Storage 通过Google App Engine(Java)将文件上传到Google云端存储 - Upload file to Google cloud storage from Google App Engine (Java) 适用于Java和Google云存储的Google App Engine - Google App Engine for Java and Google Cloud Storage 从App Engine Java将urlconnection文件保存到Google云存储 - saving a urlconnection file to google cloud storage from app engine java 如何使用Google App Engine(Java)创建剩余端点以将多部分数据上传到Google云存储 - How to create a rest endpoint using Google App Engine (Java) to upload multi part data to google cloud storage 通过Google App Engine(JAVA)将文件(图像或视频)从JSP上传到Google云存储 - Upload File (image or video) from JSP to google cloud storage via Google app engine(JAVA) 亚马逊是否提供低成本的云存储后门,以通过Servlet(例如Google App Engine)来提供文件? - Does Amazon provide low cost cloud storage backdoor for serving files from a Servlet like Google App Engine? 无法通过Google App Engine Servlet(Java)将对象存储在Google Cloud Storage中 - Cannot store objects in my Google Cloud Storage from my Google App Engine Servlet (Java)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM