无法删除blob数据(gae + java + datastore)

时间:2014-01-10 14:59:37

标签: java google-app-engine struts2 google-cloud-datastore

我从数据存储区删除blob数据遇到了一些奇怪的问题。并一遍又一遍地搜索,但我找不到任何相关的解决方案。这引出了我的第一个问题。

问题是我无法删除blob数据。它在本地正常工作,但每次部署到GAE后都会失败。

以下是我用来删除blob数据的代码

ps:代码用动作类

中的struts2方法编写
BlobstoreService blobstoreService = BlobstoreServiceFactory.getBlobstoreService();      
BlobInfoFactory bif = new BlobInfoFactory();
BlobKey bk = new BlobKey("the string blob key here");
BlobInfo blobInfo = bif.loadBlobInfo(bk);       
if (blobInfo != null) {
    blobstoreService.delete(new BlobKey(personKey.getName()));
    System.out.println("deleted");

}

这是错误

Struts Problem Report

Struts has detected an unhandled exception:

Messages:   
The key.path.element.type "__BlobInfo__" is reserved.
File:   com/google/appengine/api/datastore/DatastoreApiHelper.java
Line number:    39
Stacktraces

java.lang.IllegalArgumentException: The key.path.element.type "__BlobInfo__" is reserved.
   com.google.appengine.api.datastore.DatastoreApiHelper.translateError(DatastoreApiHelper.java:39)
   com.google.appengine.api.datastore.DatastoreApiHelper$1.convertException(DatastoreApiHelper.java:76)
   com.google.appengine.api.utils.FutureWrapper.get(FutureWrapper.java:94)
   com.google.appengine.api.datastore.AsyncDatastoreServiceImpl$10.get(AsyncDatastoreServiceImpl.java:622)
   com.google.appengine.api.datastore.AsyncDatastoreServiceImpl$10.get(AsyncDatastoreServiceImpl.java:618)
   com.google.appengine.api.utils.FutureWrapper.get(FutureWrapper.java:86)
   com.google.appengine.api.utils.FutureWrapper.get(FutureWrapper.java:86)
   com.google.appengine.api.datastore.FutureHelper.getInternal(FutureHelper.java:71)
   com.google.appengine.api.datastore.FutureHelper.quietGet(FutureHelper.java:32)
   com.google.appengine.api.datastore.DatastoreServiceImpl$3.runInternal(DatastoreServiceImpl.java:121)
   com.google.appengine.api.datastore.DatastoreServiceImpl$3.runInternal(DatastoreServiceImpl.java:118)
   com.google.appengine.api.datastore.TransactionRunner.runInTransaction(TransactionRunner.java:29)
   com.google.appengine.api.datastore.DatastoreServiceImpl.delete(DatastoreServiceImpl.java:118)
   com.google.appengine.api.datastore.DatastoreServiceImpl.delete(DatastoreServiceImpl.java:107)
   root.service.CloudService.delete(CloudService.java:114)
   root.action.cloud.CloudAction.doDelete(CloudAction.java:75)
   sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
   sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   java.lang.reflect.Method.invoke(Method.java:45)
   com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:450)
   com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:289)
   com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:252)
   org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:256)
   com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
   com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:167)
   com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
   com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
   com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:265)
   org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:68)
   com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
   com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
   com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:138)
   com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
   com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:239)
   com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
   com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
   com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:239)
   com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
   com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
   com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:191)
   com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
   org.apache.struts2.interceptor.MultiselectInterceptor.intercept(MultiselectInterceptor.java:73)
   com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
   org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:91)
   com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
   org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:252)
   com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
   com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:100)
   com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
   com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:141)
   com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
   com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:145)
   com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
   com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:171)
   com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
   com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
   com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:161)
   com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
   org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164)
   com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
   com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:193)
   com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
   com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:189)
   com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
   org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:54)
   org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:563)
   org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77)
   org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:99)
   org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
   org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
   org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
   org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
   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)
   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)
   org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:923)
   org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
   com.google.tracing.TraceContext$TraceContextRunnable.runInContext(TraceContext.java:435)
   com.google.tracing.TraceContext$TraceContextRunnable$1.run(TraceContext.java:442)
   com.google.tracing.CurrentContext.runInContext(CurrentContext.java:186)
   com.google.tracing.TraceContext$AbstractTraceContextCallback.runInInheritedContextNoUnref(TraceContext.java:306)
   com.google.tracing.TraceContext$AbstractTraceContextCallback.runInInheritedContext(TraceContext.java:298)
   com.google.tracing.TraceContext$TraceContextRunnable.run(TraceContext.java:439)
   java.lang.Thread.run(Thread.java:724)

You are seeing this page because development mode is enabled. Development mode, or devMode, enables extra debugging behaviors and reports to assist developers. To disable this mode, set:

 struts.devMode=false
in your WEB-INF/classes/struts.properties file.

0 个答案:

没有答案