Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

exception loading sessions from persistent storage

I have made many changes to the spring petclinic application. At the moment, I am getting the following error message when I launch the application in a new instance of tomcat server using eclipse run as...run on server:

SEVERE: Exception loading sessions from persistent storage   

The server and application then subsequently are able to launch successfully, but I would like to fix whatever is causing the error message. Can anyone show me how to get past this error message?

The stack trace does not list any file from the application, so I don't know where to look in the application code to fix the problem. You can look in the petclinic code at github to see the structure of the application, if that helps you see where I should look to find the problem. Here is the stack trace:

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'   
like image 569
CodeMed Avatar asked Dec 16 '13 23:12

CodeMed


1 Answers

This is to do with Tomcat not being able to load previously serialized web sessions that had been saved on an earlier shutdown. This may be because Tomcat didn't shutdown cleanly and so session objects got corrupted during serialization.

One way to make this error go away would be to disable session persistence across restarts. You can do this by editing the file CATALINA_HOME/conf/context.xml and setting the pathname attribute of the <Manager> to an empty string. This is well documented in the file for Tomcat 7:

<!-- Uncomment this to disable session persistence across Tomcat restarts -->  <Manager pathname="" /> 

You should also delete any old session.ser files from the CATALINA_HOME/work/Catalina/localhost/<appName> folder whilst Tomcat is shutdown.

This may not be acceptable in your case if session persistence across restarts is needed. In which case further debugging of the issue would be necessary.

like image 170
Will Keeling Avatar answered Oct 05 '22 17:10

Will Keeling