• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

无法通过我的Google App Engine Servlet(Java)在Google云端存储中存储对象

java 来源:Guy A. Levanon 4次浏览

我正在使用我的App Engine允许应用上传文件。 该文件在HTTP POST中收到,我试图将其存储在Google Storage中。无法通过我的Google App Engine Servlet(Java)在Google云端存储中存储对象

我的服务器代码;

GcsFileOptions instance = GcsFileOptions.getDefaultInstance(); 
GcsFilename fileName = new GcsFilename("my-bucket", "file.dat"); 
GcsOutputChannel outputChannel; 

log.info("Saving " + fileName + " to " + instance); 

outputChannel = gcsService.createOrReplace(fileName, instance); 
copy(req.getInputStream(), Channels.newOutputStream(outputChannel)); 

中间产量的日志条目;

com.my.app.Servlet: Saving GcsFilename(my-bucket, file.dat) to GcsFileOptions [userMetadata={}] 

这导致异常;

com.google.appengine.tools.cloudstorage.RetriesExhaustedException: RetryHelper(5.644 s, 10 attempts, [email protected]c): Too many failures, giving up 
    at com.google.appengine.tools.cloudstorage.RetryHelper.doRetry(RetryHelper.java:127) 
    at com.google.appengine.tools.cloudstorage.RetryHelper.runWithRetries(RetryHelper.java:166) 
    at com.google.appengine.tools.cloudstorage.RetryHelper.runWithRetries(RetryHelper.java:156) 
    at com.google.appengine.tools.cloudstorage.GcsServiceImpl.createOrReplace(GcsServiceImpl.java:70) 
    at com.my.app.Servlet.saveFile(Servlet.java:128) 
    at com.my.app.Servlet.doPost(Servlet.java:107) 
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:707) 
... <Cut by submitter> 
Caused by: java.io.IOException: java.lang.NullPointerException 
    at com.google.appengine.tools.cloudstorage.dev.LocalRawGcsService$BlobStorageAdapter.getInstance(LocalRawGcsService.java:186) 
    at com.google.appengine.tools.cloudstorage.dev.LocalRawGcsService$BlobStorageAdapter.access$000(LocalRawGcsService.java:109) 
    at com.google.appengine.tools.cloudstorage.dev.LocalRawGcsService.ensureInitialized(LocalRawGcsService.java:194) 
    at com.google.appengine.tools.cloudstorage.dev.LocalRawGcsService.beginObjectCreation(LocalRawGcsService.java:249) 
    at com.google.appengine.tools.cloudstorage.dev.LocalRawGcsService.beginObjectCreation(LocalRawGcsService.java:92) 
    at com.google.appengine.tools.cloudstorage.GcsServiceImpl$1.call(GcsServiceImpl.java:74) 
    at com.google.appengine.tools.cloudstorage.GcsServiceImpl$1.call(GcsServiceImpl.java:70) 
    at com.google.appengine.tools.cloudstorage.RetryHelper.doRetry(RetryHelper.java:108) 
    ... 34 more 
Caused by: java.lang.NullPointerException 
    at com.google.appengine.tools.cloudstorage.dev.LocalRawGcsService$BlobStorageAdapter.<init>(LocalRawGcsService.java:123) 
    at com.google.appengine.tools.cloudstorage.dev.LocalRawGcsService$BlobStorageAdapter.getInstance(LocalRawGcsService.java:184) 
    ... 41 more 

===========解决方案如下:

已解决。这个问题(类似的情况)已经在这里得到解答:How to fetch the file list from gcs?


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)