2
我尝试上传一个小的TXT文件(4KB)到Google App Engine DataStore。当我在本地测试应用程序时,我没有任何问题,并且文件成功保存;但是当我在GAE试试我得到以下错误:javax.jdo.JDOException:字符串属性文件太长。它不能超过1000000个字符
javax.jdo.JDOException: string property file is too long. It cannot exceed 1000000 characters.
NestedThrowables:
java.lang.IllegalArgumentException: string property file is too long. It cannot exceed 1000000 characters
在GAE控制台,日志下面说:
com.google.apphosting.api.ApiProxy$RequestTooLargeException: The request to API call datastore_v3.Put() was too large.
at com.google.apphosting.runtime.ApiProxyImpl$AsyncApiFuture.success(ApiProxyImpl.java:480)
at com.google.apphosting.runtime.ApiProxyImpl$AsyncApiFuture.success(ApiProxyImpl.java:380)
at com.google.net.rpc3.client.RpcStub$RpcCallbackDispatcher$1.runInContext(RpcStub.java:746)
at com.google.tracing.TraceContext$TraceContextRunnable$1.run(TraceContext.java:455)
at com.google.tracing.TraceContext.runInContext(TraceContext.java:695)
at com.google.tracing.TraceContext$AbstractTraceContextCallback.runInInheritedContextNoUnref(TraceContext.java:333)
包含该文件的实体的JDO映射如下:
@PersistenceCapable(identityType = IdentityType.APPLICATION)
public class AppointmentEntity implements Serializable {
@PrimaryKey
@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
private Long id;
@Persistent(serialized = "true")
private DownloadableFile file;
而且DownloadableFile是:
public class DownloadableFile implements Serializable {
private byte[] content;
private String filename;
private String mimeType;
任何想法是什么错?我读了一些关于会话大小和实体大小的内容,但小文件大小让我放弃了这些理论。
每个数据存储实体的最大尺寸为[1MB](http://code.google.com/appengine/文档/蟒蛇/数据存储/ overview.html#Datastore_Statistics)。看到你的文本文件只有4KB,你能以某种方式将它添加到DS多次?这也许可以解释为什么你达到了极限。 – 2012-03-01 14:35:49
我不这么认为,更新只执行一次。如果实体的大小大于1MB,那么本地数据存储会抱怨? – 2012-03-01 14:47:59