将图像保存到 Google App Engine/Java 时出错
我正在尝试在 GAE/J 中创建以下 JDO 实体(我正在使用 Gilead )。
package test.domains;
import java.io.Serializable;
import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.IdentityType;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;
import net.sf.gilead.pojo.java5.LightEntity;
import com.google.appengine.api.datastore.Blob;
import com.google.appengine.api.datastore.Key;
@PersistenceCapable(identityType=IdentityType.APPLICATION, detachable="true")
public class Banner extends LightEntity implements Serializable
{
private static final long serialVersionUID = 1058354709157710766L;
// Fields
@PrimaryKey
@Persistent(valueStrategy=IdGeneratorStrategy.IDENTITY)
private Key id;
@Persistent
private String name;
@Persistent
private String sizeX;
@Persistent
private String sizeY;
@Persistent
private String description;
@Persistent
private Blob img;
// Getters and Setters
}
并遇到以下问题:
[错误]第 40 行:没有源代码 可用于类型 com.google.appengine.api.datastore.Blob; 你是否忘记继承一个必需的 模块?
什么会导致这个问题?代码在没有 Blob 对象的情况下编译良好。顺便说一句,我尝试遵循 这个示例。
I'm trying to make following JDO entity in GAE/J (I'm using Gilead).
package test.domains;
import java.io.Serializable;
import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.IdentityType;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;
import net.sf.gilead.pojo.java5.LightEntity;
import com.google.appengine.api.datastore.Blob;
import com.google.appengine.api.datastore.Key;
@PersistenceCapable(identityType=IdentityType.APPLICATION, detachable="true")
public class Banner extends LightEntity implements Serializable
{
private static final long serialVersionUID = 1058354709157710766L;
// Fields
@PrimaryKey
@Persistent(valueStrategy=IdGeneratorStrategy.IDENTITY)
private Key id;
@Persistent
private String name;
@Persistent
private String sizeX;
@Persistent
private String sizeY;
@Persistent
private String description;
@Persistent
private Blob img;
// Getters and Setters
}
And encountering following problem:
[ERROR] Line 40: No source code is
available for type
com.google.appengine.api.datastore.Blob;
did you forget to inherit a required
module?
What can cause this problem? The code compiles fine without Blob object. By the way I tried to follow this example.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
据我所知,吉利德不支持
com.google.appengine.api.datastore.Blob
。adapter4appengine-1.0M2.jar
包含“com.google.appengine.api.datastore.Key”的模拟器类As far as i can tell, it is Gilead that does not have support for
com.google.appengine.api.datastore.Blob
.The
adapter4appengine-1.0M2.jar
on contains an emulator class for 'com.google.appengine.api.datastore.Key'您是否将该文件保存在客户端?这是我认为 GWT 找不到 Blob .class 文件的唯一原因。
试一试。
海梅·E
Are you keeping that file in the client side? That's the only reason I can think GWT is not finding the Blob .class file.
Give it a shot.
Jaime E