【发布时间】:2012-03-19 13:54:20
【问题描述】:
我尝试将一个小型 TXT 文件 (4KB) 上传到 Google App Engine DataStore。当我在本地测试应用程序时,我没有问题并且文件成功保存;但是当我在 GAE 中尝试时,出现以下错误:
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。看到你的文本文件只有 4KB,你能以某种方式将它多次添加到 DS 中吗?它可以解释为什么你会达到极限。
-
我不这么认为,更新只执行一次。如果实体的大小大于 1MB,本地数据存储会抱怨吗?
标签: google-app-engine google-cloud-datastore jdo