从持久性存储异常加载会话

2022-08-31 17:24:21

我对弹簧石化应用进行了许多更改。目前,当我使用eclipse run as在tomcat服务器的新实例中启动应用程序时,我收到以下错误消息...在服务器上运行:

SEVERE: Exception loading sessions from persistent storage  

然后,服务器和应用程序随后能够成功启动,但我想修复导致错误消息的任何内容。任何人都可以告诉我如何通过此错误消息?

堆栈跟踪不会列出应用程序中的任何文件,因此我不知道在应用程序代码中查找以解决问题的位置。您可以在github上查看petclinic代码以查看应用程序的结构,如果这有助于您了解我应该在哪里查找问题。下面是堆栈跟踪:

INFO  EhCacheManagerFactoryBean - Initializing EhCache CacheManager
INFO  ContextLoader - Root WebApplicationContext: initialization completed in 4376 ms
Dec 16, 2013 2:51:56 PM org.apache.catalina.session.StandardManager doLoad
SEVERE: IOException while loading persisted sessions: java.io.EOFException  
java.io.EOFException
    at java.io.ObjectInputStream$PeekInputStream.readFully(ObjectInputStream.java:2280)
    at java.io.ObjectInputStream$BlockDataInputStream.readShort(ObjectInputStream.java:2749)
    at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:779)
    at java.io.ObjectInputStream.<init>(ObjectInputStream.java:279)
    at org.apache.catalina.util.CustomObjectInputStream.<init>(CustomObjectInputStream.java:58)
    at org.apache.catalina.session.StandardManager.doLoad(StandardManager.java:246)
    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:5443)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
    at java.util.concurrent.FutureTask.run(FutureTask.java:138)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    at java.lang.Thread.run(Thread.java:662)
Dec 16, 2013 2:51:56 PM org.apache.catalina.session.StandardManager startInternal
SEVERE: Exception loading sessions from persistent storage  
java.io.EOFException
    at java.io.ObjectInputStream$PeekInputStream.readFully(ObjectInputStream.java:2280)
    at java.io.ObjectInputStream$BlockDataInputStream.readShort(ObjectInputStream.java:2749)
    at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:779)
    at java.io.ObjectInputStream.<init>(ObjectInputStream.java:279)
    at org.apache.catalina.util.CustomObjectInputStream.<init>(CustomObjectInputStream.java:58)
    at org.apache.catalina.session.StandardManager.doLoad(StandardManager.java:246)
    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:5443)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
    at java.util.concurrent.FutureTask.run(FutureTask.java:138)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    at java.lang.Thread.run(Thread.java:662)
Dec 16, 2013 2:51:56 PM org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring FrameworkServlet 'petclinic'  

答案 1

这与Tomcat无法加载以前序列化的Web会话有关,这些会话在早期关闭时已保存。这可能是因为 Tomcat 没有完全关闭,因此会话对象在序列化过程中损坏了。

使此错误消失的一种方法是在重新启动时禁用会话持久性。您可以通过编辑文件并将 的属性设置为空字符串来执行此操作。这在Tomcat 7的文件中有很好的记录:CATALINA_HOME/conf/context.xmlpathname<Manager>

<!-- Uncomment this to disable session persistence across Tomcat restarts -->

<Manager pathname="" />

您还应该在Tomcat关闭时从文件夹中删除任何旧文件。session.serCATALINA_HOME/work/Catalina/localhost/<appName>

如果您的情况是,如果需要跨重新启动的会话持久性,则可能无法接受。在这种情况下,需要进一步调试问题。


答案 2

删除 tomcat “work” 文件夹。重新启动tomcat服务器,希望现在它将运行没有任何例外或错误!

这可以通过选择Tomcat中的服务器并选择“清理Tomcat工作目录”来完成。

enter image description here


推荐