尝试返回自定义对象类型时出现 SerializationException
我只是创建最简单的 Singleton EJB 来返回自定义可序列化对象,但是当我调用远程方法时出现以下异常:
org.jboss.serial.exception.SerializationException: Could not create instance of model.Usuario - model .Usuario
它适用于简单类型和普通类(例如 String),但不适用于属于我创建的类的对象。
我正在使用 JBoss 6.0 和 Eclipse。
我可能会错过什么?
提前致谢, 扫罗
I just create the most simple Singleton EJB to return a custom serializable object, but I'm getting the following exception when I invoke the remote method:
org.jboss.serial.exception.SerializationException: Could not create instance of model.Usuario - model.Usuario
It works fine with simple types and normal classes (String for example) but not for an object pertaining to a class I created.
I'm using JBoss 6.0 and Eclipse.
What could I be missing?
Thanks in advance,
Saul
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您尝试序列化的类必须实现
Serialized
标记接口或扩展实现它的类。此外,类中的每个非瞬态成员也必须是Serialized
。The class you are trying to serialize must implement the
Serializable
marker interface or extend a class that implements it. Also, every non-transient member of your class must also beSerializable
.1.您应该使您的对象实现
Serialized< /code>
2.将所有不可序列化字段标记为
transient
。1.You should make your Object implementing
Serializable
2.Have all nonserializable fields marked as
transient
.