我创建了一个使用google cloud storage
client lib
的应用,允许用户将文件上传到云端。
我创建了一个存储桶并将我的项目帐户添加到其ACL中,如下所示:
此外,我的项目已启用结算功能。但是,在我部署我的应用程序并尝试选择文件将其上传到谷歌云后,它给了我以下例外:
/StdPersistentStorageClient
com.google.appengine.tools.cloudstorage.NonRetriableException: java.lang.RuntimeException: Server replied with 400, probably bad request: Request: PUT https://storage.googleapis.com/persistentstoragebucket/?upload_id=AEnB2Uq7SzQtkKjLb4mPdZiBlKJokLcXnn9R-wcdQzHphk5EsWwePwLU22u0aUP1Z9MFN28kIwoKvNxjfVIvMr5CO0YgjI9ihQ
User-Agent: App Engine GCS Client
Content-Range: bytes */0
no content
Response: 400 with 154 bytes of content
Content-Type: application/xml; charset=UTF-8
Content-Length: 154
Vary: Origin
Date: Fri, 09 Jan 2015 22:44:58 GMT
Server: UploadServer ("Built on Dec 19 2014 10:24:45 (1419013485)")
Alternate-Protocol: 443:quic,p=0.02
X-Google-Cache-Control: remote-fetch
Via: HTTP/1.1 GWA
<?xml version='1.0' encoding='UTF-8'?><Error><Code>InvalidArgument</Code><Message>Invalid argument.</Message><Details>Missing project id</Details></Error>
at com.google.appengine.tools.cloudstorage.RetryHelper.doRetry(RetryHelper.java:120)
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.GcsOutputChannelImpl.close(GcsOutputChannelImpl.java:198)
at java.nio.channels.Channels$1.close(Channels.java:178)
at fci.cu.std.paas.api.xml.manifest.utilities.ManifestUtilities.copy(ManifestUtilities.java:83)
at fci.cu.std.paas.core.services.persistent.storage.PersistentStorageService.uploadBlob(PersistentStorageService.java:130)
at fci.cu.std.paas.client.services.persistent.storage.StdPersistentStorageClient.doPost(StdPersistentStorageClient.java:102)
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.JdbcMySqlConnectionCleanupFilter.doFilter(JdbcMySqlConnectionCleanupFilter.java:60)
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:254)
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:484)
at com.google.tracing.TraceContext$TraceContextRunnable.runInContext(TraceContext.java:438)
at com.google.tracing.TraceContext$TraceContextRunnable$1.run(TraceContext.java:445)
at com.google.tracing.CurrentContext.runInContext(CurrentContext.java:220)
at com.google.tracing.TraceContext$AbstractTraceContextCallback.runInInheritedContextNoUnref(TraceContext.java:309)
at com.google.tracing.TraceContext$AbstractTraceContextCallback.runInInheritedContext(TraceContext.java:301)
at com.google.tracing.TraceContext$TraceContextRunnable.run(TraceContext.java:442)
at com.google.apphosting.runtime.ThreadGroupPool$PoolEntry.run(ThreadGroupPool.java:251)
at java.lang.Thread.run(Thread.java:724)
你可以帮我解决这个问题
答案 0 :(得分:2)
嗯,你没有发布你的代码,所以很难确定,但是你正在做一个PUT到{34}} {&#34} 34 ;. &#34; persistantstoragebucket&#34;是一个存储桶名称,但之后应该有一个对象名称。仅使用存储桶名称,它看起来像存储桶创建请求,需要项目ID(因此您的错误)。
您是否未指定您尝试上传的对象的名称?