xPage managedBean ODA应用程序错误

时间:2016-06-01 07:38:26

标签: java xpages

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

有什么想法吗?

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)

1 个答案:

答案 0 :(得分:1)

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

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

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