尝试序列化时捕获异常

发布于 2024-11-14 06:13:35 字数 399 浏览 0 评论 0原文

我的日志中出现以下错误

[6/6/11 17:16:33:558 CEST] 00000005 WASSession    E MTMBuffWrapper storeObject SESN0200E: Caught Exception while trying to serialize.
[6/6/11 17:16:33:558 CEST] 00000005 WASSession    E MTMHashMap handlePropertyHits SESN0202E: Failed to replicate attribute changeBankStatusForm

我已识别出引发此错误的对象,该对象很大,很多属性包含它们自身属性

如何识别引发序列化错误的确切属性

谢谢

I've the following error in my logs

[6/6/11 17:16:33:558 CEST] 00000005 WASSession    E MTMBuffWrapper storeObject SESN0200E: Caught Exception while trying to serialize.
[6/6/11 17:16:33:558 CEST] 00000005 WASSession    E MTMHashMap handlePropertyHits SESN0202E: Failed to replicate attribute changeBankStatusForm

I've identified the object which raise this error, this object is huge, a lot of attribute containing them self attributes

How can I identify the exact attribute which raise the serialization error

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(1

灯角 2024-11-21 06:13:35

更新看来您的应用程序服务器错误地处理了异常,因此您必须手动查看所有字段并检查它们的类型是否实现Serialized


您很可能正在处理你的例外错误。我假设你正在做:

try { ..
} catch(Exception ex) {
   System.out.println("Caught Exception while trying to serialize"); // wrong
   ex.printStackTrace(); // better
   logger.error("Serialization problem", ex); //best
}

如果是这样的话 - 你无法获得更多信息,因为你已经吞下了异常。您应该调用 ex.printStackTrace() (或使用日志框架)

,然后异常会告诉您哪个类未能序列化,因此您将能够将其标记为 Serializable< /代码>

Update it appears that your application server is handling the exception wrongly, so you'd have to manually look through all fields and check if their types implement Serializable


You are most likely handling your exception wrong. I assume you are doing:

try { ..
} catch(Exception ex) {
   System.out.println("Caught Exception while trying to serialize"); // wrong
   ex.printStackTrace(); // better
   logger.error("Serialization problem", ex); //best
}

If that's the case - you can't get any more info, because you've swallowed the exception. You should call ex.printStackTrace() instead (or use a logging framework)

Then the exception will tell you which class fails the serialization, and so you will be able to mark it as Serializable

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