gpt4 book ai didi

java - xPage ManagedBean ODA 应用程序错误

转载 作者:行者123 更新时间:2023-11-30 07:21:05 25 4
gpt4 key购买 nike

从一页导航到另一页时不断出现以下错误。至少从堆栈跟踪来看,错误与我的任何代码无关。从调试打印看来,它是在页面加载后发生的。

有什么想法吗?

com.ibm.xsp.FacesExceptionEx: java.io.NotSerializableException: org.openntf.domino.impl.Document
com.ibm.xsp.application.AbstractStateManager.saveSerializedView(AbstractStateManager.java:121)
com.ibm.xsp.application.StateManagerImpl.saveSerializedView(StateManagerImpl.java:152)
com.ibm.xsp.application.ViewHandlerExImpl._saveViewState(ViewHandlerExImpl.java:455)
com.ibm.xsp.application.ViewHandlerExImpl.saveViewState(ViewHandlerExImpl.java:449)
com.ibm.xsp.application.ViewHandlerExImpl._renderView(ViewHandlerExImpl.java:324)
com.ibm.xsp.application.ViewHandlerExImpl.renderView(ViewHandlerExImpl.java:336)
com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:103)
com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:210)
com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:120)
com.ibm.xsp.controller.FacesControllerImpl.render(FacesControllerImpl.java:270)
com.ibm.xsp.webapp.FacesServlet.serviceView(FacesServlet.java:261)
com.ibm.xsp.webapp.FacesServletEx.serviceView(FacesServletEx.java:157)
com.ibm.xsp.webapp.FacesServlet.service(FacesServlet.java:160)
com.ibm.xsp.webapp.FacesServletEx.service(FacesServletEx.java:138)
com.ibm.xsp.webapp.DesignerFacesServlet.service(DesignerFacesServlet.java:103)
com.ibm.designer.runtime.domino.adapter.ComponentModule.invokeServlet(ComponentModule.java:588)
com.ibm.domino.xsp.module.nsf.NSFComponentModule.invokeServlet(NSFComponentModule.java:1335)
com.ibm.designer.runtime.domino.adapter.ComponentModule$AdapterInvoker.invokeServlet(ComponentModule.java:865)
com.ibm.designer.runtime.domino.adapter.ComponentModule$ServletInvoker.doService(ComponentModule.java:808)
com.ibm.designer.runtime.domino.adapter.ComponentModule.doService(ComponentModule.java:577)
com.ibm.domino.xsp.module.nsf.NSFComponentModule.doService(NSFComponentModule.java:1319)
com.ibm.domino.xsp.module.nsf.NSFService.doServiceInternal(NSFService.java:662)
com.ibm.domino.xsp.module.nsf.NSFService.doService(NSFService.java:482)
com.ibm.designer.runtime.domino.adapter.LCDEnvironment.doService(LCDEnvironment.java:357)
com.ibm.designer.runtime.domino.adapter.LCDEnvironment.service(LCDEnvironment.java:313)
com.ibm.domino.xsp.bridge.http.engine.XspCmdManager.service(XspCmdManager.java:272)
java.io.NotSerializableException: org.openntf.domino.impl.Document
java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1185)
java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:346)
java.util.TreeMap.writeObject(TreeMap.java:5740)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
java.lang.reflect.Method.invoke(Method.java:611)
java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:1059)
java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1502)
java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1433)
java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1179)
java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1555)
java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1516)
java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1433)
java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1179)
java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1555)
java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1516)
java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1433)
java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1179)
java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:346)
java.util.HashMap.writeObject(HashMap.java:942)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
java.lang.reflect.Method.invoke(Method.java:611)
java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:1059)
java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1502)
java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1433)
java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1179)
java.io.ObjectOutputStream.writeUnshared(ObjectOutputStream.java:413)
com.ibm.xsp.application.AbstractSerializingStateManager$FastObjectOutputStream.writeObjectEx(AbstractSerializingStateManager.java:438)
com.ibm.xsp.application.AbstractSerializingStateManager$FastObjectOutputStream.writeObjectEx(AbstractSerializingStateManager.java:417)
com.ibm.xsp.application.AbstractSerializingStateManager$FastObjectOutputStream.writeObjectEx(AbstractSerializingStateManager.java:417)
com.ibm.xsp.application.AbstractSerializingStateManager$FastObjectOutputStream.writeObjectEx(AbstractSerializingStateManager.java:417)
com.ibm.xsp.application.AbstractSerializingStateManager$FastObjectOutputStream.writeObjectEx(AbstractSerializingStateManager.java:417)
com.ibm.xsp.application.AbstractSerializingStateManager.saveSerializedView(AbstractSerializingStateManager.java:294)
com.ibm.xsp.application.AbstractSerializingStateManager.doSaveSerializedView(AbstractSerializingStateManager.java:269)
com.ibm.xsp.application.FileStateManager.doSaveSerializedView(FileStateManager.java:290)
com.ibm.xsp.application.FileStateManager.doSaveSerializedView(FileStateManager.java:270)
com.ibm.xsp.application.AbstractStateManager.saveSerializedView(AbstractStateManager.java:114)
com.ibm.xsp.application.StateManagerImpl.saveSerializedView(StateManagerImpl.java:152)
com.ibm.xsp.application.ViewHandlerExImpl._saveViewState(ViewHandlerExImpl.java:455)
com.ibm.xsp.application.ViewHandlerExImpl.saveViewState(ViewHandlerExImpl.java:449)
com.ibm.xsp.application.ViewHandlerExImpl._renderView(ViewHandlerExImpl.java:324)
com.ibm.xsp.application.ViewHandlerExImpl.renderView(ViewHandlerExImpl.java:336)
com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:103)
com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:210)
com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:120)
com.ibm.xsp.controller.FacesControllerImpl.render(FacesControllerImpl.java:270)
com.ibm.xsp.webapp.FacesServlet.serviceView(FacesServlet.java:261)
com.ibm.xsp.webapp.FacesServletEx.serviceView(FacesServletEx.java:157)
com.ibm.xsp.webapp.FacesServlet.service(FacesServlet.java:160)
com.ibm.xsp.webapp.FacesServletEx.service(FacesServletEx.java:138)
com.ibm.xsp.webapp.DesignerFacesServlet.service(DesignerFacesServlet.java:103)
com.ibm.designer.runtime.domino.adapter.ComponentModule.invokeServlet(ComponentModule.java:588)
com.ibm.domino.xsp.module.nsf.NSFComponentModule.invokeServlet(NSFComponentModule.java:1335)
com.ibm.designer.runtime.domino.adapter.ComponentModule$AdapterInvoker.invokeServlet(ComponentModule.java:865)
com.ibm.designer.runtime.domino.adapter.ComponentModule$ServletInvoker.doService(ComponentModule.java:808)
com.ibm.designer.runtime.domino.adapter.ComponentModule.doService(ComponentModule.java:577)
com.ibm.domino.xsp.module.nsf.NSFComponentModule.doService(NSFComponentModule.java:1319)
com.ibm.domino.xsp.module.nsf.NSFService.doServiceInternal(NSFService.java:662)
com.ibm.domino.xsp.module.nsf.NSFService.doService(NSFService.java:482)
com.ibm.designer.runtime.domino.adapter.LCDEnvironment.doService(LCDEnvironment.java:357)
com.ibm.designer.runtime.domino.adapter.LCDEnvironment.service(LCDEnvironment.java:313)
com.ibm.domino.xsp.bridge.http.engine.XspCmdManager.service(XspCmdManager.java:272)

最佳答案

您不能在托管 bean 中存储任何 Domino 对象。正如该方法所说,它不可序列化。 ODA 无法解决这个问题。

我的建议是存储 DominoDocument 对象(如果您需要前端文档,因此在 bean 的生命周期中更新它,但不是每次都保存)或 UNID(如果您只需要后端文档) 。 Database.getDocumentByUNID() 速度非常快,因此您不必担心获取文档对性能的影响。

如果您想避免在 XPages 生命周期中多次获取文档,请将生成的 Document 对象放入 requestScope 中,并在从数据库检索之前检查那里。或者(我不确定这是什么最佳实践,或者是否已正确清理),可以选择将变量设置为 transient ,因此它不会在每个结束时被序列化请求,但在每次部分刷新期间将保留在 bean 中。

关于java - xPage ManagedBean ODA 应用程序错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37562319/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com