6

I'm working on a Spring Boot (v1.3.3.RELEASE) project. The included Tomcat Embedded version is 8.0.32.

I'm getting this error:

2016-08-01 14:51:23.354 ERROR 6704 --- [ost-startStop-1] o.a.catalina.session.StandardManager     : Exception loading sessions from persistent storage

java.io.EOFException: null
    at java.io.ObjectInputStream$PeekInputStream.readFully(ObjectInputStream.java:2335)
    ...

I read about the same error on this question: exception loading sessions from persistent storage but I cannot find the solution to my issue.

I tried to apply the solutions suggested in the aswers, but in my case I cannot find the way to "Clean Tomcat Work Directory" or just to make a clean deploy of my application.

How can I solve this? Where can I find work folder for Tomcat Embedded version?

NOTE I'm using Eclipse as IDE

davioooh
  • 23,742
  • 39
  • 159
  • 250
  • well the error clearly indicates that during restart or shut down of your spring app , some certain files got corrupted. in case you want to use the the Persistent Session you have to configure it properly with the Persistent Manager , mentioned in this [link](https://tomcat.apache.org/tomcat-5.5-doc/config/manager.html) ( for tomcat 5.5) , otherwise a solution is to completely disable it with this [answer](http://stackoverflow.com/questions/27130157/how-to-disable-tomact-session-persistence-in-spring-boot-via-manager-pathname) – AntJavaDev Aug 01 '16 at 13:22

1 Answers1

8

I finally found the solution to my issue.

Reading the anwer to this question: How to disable Tomact session persistence in Spring Boot via Manager pathname? (suggested by AntJavaDev) I configured this bean:

@Bean
public EmbeddedServletContainerFactory servletContainer() {
    TomcatEmbeddedServletContainerFactory tomcat = new TomcatEmbeddedServletContainerFactory();
    tomcat.addContextCustomizers(new TomcatContextCustomizer() {

        @Override
        public void customize(Context context) {
            if (context.getManager() instanceof StandardManager) {
                // print local path name
                System.out.println(((StandardManager) context.getManager()).getPathname());
            }
        }
    });
    return tomcat;
}

This way I discovered where cached sessions are stored for Tomcat Embedded (on Windows):

C:\Users\<my-user>\AppData\Local\Temp\<random-id>\servlet-sessions\

I deleted the SESSIONS.ser file in this folder and the error is magically disappeared.

Community
  • 1
  • 1
davioooh
  • 23,742
  • 39
  • 159
  • 250
  • glad it helped:) , but still have you found any clue why it happened from the first place ? were you killing the spring boot app manually ? without letting the context close properly ? – AntJavaDev Aug 01 '16 at 14:09
  • @AntJavaDev Yes, probably the problem was caused by a wrong application stop. Thank you very much! – davioooh Aug 01 '16 at 14:11
  • The correct name of the file is "session.ser" instead of "sessions.ser". It worked for me. Thanks. – d9daniel Sep 28 '17 at 08:10