尝试返回自定义对象类型时出现 SerializationException

发布于 2024-10-06 12:49:13 字数 301 浏览 1 评论 0原文

我只是创建最简单的 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

神妖 2024-10-13 12:49:13

您尝试序列化的类必须实现 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 be Serializable.

可是我不能没有你 2024-10-13 12:49:13

1.您应该使您的对象实现 Serialized< /code>

2.将所有不可序列化字段标记为transient

1.You should make your Object implementing Serializable

2.Have all nonserializable fields marked as transient.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文