我对springpetclinic应用程序进行了许多更改。目前,当我使用eclipse as 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'
这与Tomcat无法加载先前关闭时保存的先前序列化的Web会话有关。这可能是因为Tomcat无法完全关闭,因此会话对象在序列化过程中被损坏了。
使该错误消失的一种方法是禁用重新启动之间的会话持久性。你可以通过编辑文件CATALINA_HOME/conf/context.xml并将的pathname属性设置为<Manager>空字符串来执行此操作。Tomcat 7的文件中对此进行了很好的记录:
CATALINA_HOME/conf/context.xml
pathname
<Manager>
<!-- Uncomment this to disable session persistence across Tomcat restarts --> <Manager pathname="" />
在Tomcat关闭时,你还应该session.ser从该CATALINA_HOME/work/Catalina/localhost/<appName>文件夹中删除所有旧文件。
session.ser
CATALINA_HOME/work/Catalina/localhost/<appName>
如果需要跨重启的会话持久性,这在你的情况下可能是不可接受的。在这种情况下,有必要对该问题进行进一步的调试。