3

启动 Tomcat 7 时出现此错误:

 sept. 24, 2012 9:59:13 AM org.apache.catalina.session.StandardManager doLoad
    Grave: "IOException" lors du chargement de sessions persistantes: java.io.WriteAbortedException: writing aborted; java.io.NotSerializableException: org.objectweb.salome_tmf.ihm.main.datawrapper.DataModel
    java.io.WriteAbortedException: writing aborted; java.io.NotSerializableException: org.objectweb.salome_tmf.ihm.main.datawrapper.DataModel
        at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1351)
        at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1964)
        at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1888)
        at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1771)
        at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1347)
        at java.io.ObjectInputStream.readObject(ObjectInputStream.java:369)
        at org.apache.catalina.session.StandardSession.readObject(StandardSession.java:1595)
        at org.apache.catalina.session.StandardSession.readObjectData(StandardSession.java:1060)
        at org.apache.catalina.session.StandardManager.doLoad(StandardManager.java:284)
        at org.apache.catalina.session.StandardManager.load(StandardManager.java:204)
        at org.apache.catalina.session.StandardManager.startInternal(StandardManager.java:491)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
        at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5293)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
        at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1595)
        at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1585)
        at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
        at java.util.concurrent.FutureTask.run(FutureTask.java:166)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
        at java.lang.Thread.run(Thread.java:722)
    Caused by: java.io.NotSerializableException: org.objectweb.salome_tmf.ihm.main.datawrapper.DataModel
        at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1180)
        at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1528)
        at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1493)
        at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1416)
        at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1174)
        at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:346)
        at org.apache.catalina.session.StandardSession.writeObject(StandardSession.java:1671)
        at org.apache.catalina.session.StandardSession.writeObjectData(StandardSession.java:1077)
        at org.apache.catalina.session.StandardManager.doUnload(StandardManager.java:432)
        at org.apache.catalina.session.StandardManager.unload(StandardManager.java:353)
        at org.apache.catalina.session.StandardManager.stopInternal(StandardManager.java:518)
        at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:232)
        at org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5473)
        at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:232)
        at org.apache.catalina.core.ContainerBase$StopChild.call(ContainerBase.java:1611)
        at org.apache.catalina.core.ContainerBase$StopChild.call(ContainerBase.java:1600)
        ... 5 more

    sept. 24, 2012 9:59:13 AM org.apache.catalina.session.StandardManager startInternal
    Grave: Exception au chargement des sessions depuis le stockage persistant (persistent storage)
    java.io.WriteAbortedException: writing aborted; java.io.NotSerializableException: org.objectweb.salome_tmf.ihm.main.datawrapper.DataModel
        at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1351)
        at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1964)
        at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1888)
        at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1771)
        at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1347)
        at java.io.ObjectInputStream.readObject(ObjectInputStream.java:369)
        at org.apache.catalina.session.StandardSession.readObject(StandardSession.java:1595)
        at org.apache.catalina.session.StandardSession.readObjectData(StandardSession.java:1060)
        at org.apache.catalina.session.StandardManager.doLoad(StandardManager.java:284)
        at org.apache.catalina.session.StandardManager.load(StandardManager.java:204)
        at org.apache.catalina.session.StandardManager.startInternal(StandardManager.java:491)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
        at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5293)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
        at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1595)
        at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1585)
        at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
        at java.util.concurrent.FutureTask.run(FutureTask.java:166)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
        at java.lang.Thread.run(Thread.java:722)
    Caused by: java.io.NotSerializableException: org.objectweb.salome_tmf.ihm.main.datawrapper.DataModel
        at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1180)
        at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1528)
        at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1493)
        at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1416)
        at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1174)
        at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:346)
        at org.apache.catalina.session.StandardSession.writeObject(StandardSession.java:1671)
        at org.apache.catalina.session.StandardSession.writeObjectData(StandardSession.java:1077)
        at org.apache.catalina.session.StandardManager.doUnload(StandardManager.java:432)
        at org.apache.catalina.session.StandardManager.unload(StandardManager.java:353)
        at org.apache.catalina.session.StandardManager.stopInternal(StandardManager.java:518)
        at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:232)
        at org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5473)
        at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:232)
        at org.apache.catalina.core.ContainerBase$StopChild.call(ContainerBase.java:1611)
        at org.apache.catalina.core.ContainerBase$StopChild.call(ContainerBase.java:1600)
        ... 5 more

这是我的课:

 public class DataModel implements ApiConstants, 

 DataConstants,IDataModelWrapper {     
  }

ApiConstants、DataConstants、IDataModelWrapper 是简单的接口。我应该实现可序列化的接口吗?

任何帮助将不胜感激 。

4

1 回答 1

4

每当您将对象添加到会话中时,您都应该始终将其添加到Serializable.

它有两个目的:

  • 如果不经常访问它,它允许容器将您的会话存储到磁盘
  • 它允许容器在同一集群的节点之间共享您的会话数据
于 2012-09-24T09:24:49.560 回答