gpt4 book ai didi

java - 无法通过我的 Google App Engine Servlet (Java) 将对象存储在我的 Google Cloud Storage 中

转载 作者:行者123 更新时间:2023-12-02 12:49:59 24 4
gpt4 key购买 nike

我正在使用 App Engine 来允许应用上传文件。该文件是通过 HTTP POST 接收的,我正在尝试将其存储在 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, com.google.appengine.tools.cloudstorage.GcsServiceImpl$1@1af95fcc): 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?

关于java - 无法通过我的 Google App Engine Servlet (Java) 将对象存储在我的 Google Cloud Storage 中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44629951/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com