tomcat启动时报:IOException while loading persisted sessions: java.io.EOFException的解决方案

Posted 微韩

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了tomcat启动时报:IOException while loading persisted sessions: java.io.EOFException的解决方案相关的知识,希望对你有一定的参考价值。

 严重: IOException while loading persisted sessions: java.io.EOFException
java.io.EOFException
    at java.io.ObjectInputStream$PeekInputStream.readFully(ObjectInputStream.java:2284)
    at java.io.ObjectInputStream$BlockDataInputStream.readShort(ObjectInputStream.java:2753)
    at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:777)
    at java.io.ObjectInputStream.<init>(ObjectInputStream.java:277)
    at org.apache.catalina.util.CustomObjectInputStream.<init>(CustomObjectInputStream.java:96)
    at org.apache.catalina.session.StandardManager.doLoad(StandardManager.java:364)
    at org.apache.catalina.session.StandardManager.load(StandardManager.java:317)
    at org.apache.catalina.session.StandardManager.start(StandardManager.java:642)
    at org.apache.catalina.core.ContainerBase.setManager(ContainerBase.java:448)
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:4665)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:803)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:780)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:583)
    at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1080)
    at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:1003)
    at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:507)
    at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1322)
    at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:325)
    at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:142)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1069)
    at org.apache.catalina.core.StandardHost.start(StandardHost.java:822)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1061)
    at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)
    at org.apache.catalina.core.StandardService.start(StandardService.java:525)
    at org.apache.catalina.core.StandardServer.start(StandardServer.java:759)
    at org.apache.catalina.startup.Catalina.start(Catalina.java:595)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
2017-1-23 13:51:36 org.apache.catalina.session.StandardManager start
严重: Exception loading sessions from persistent storage
java.io.EOFException
    at java.io.ObjectInputStream$PeekInputStream.readFully(ObjectInputStream.java:2284)
    at java.io.ObjectInputStream$BlockDataInputStream.readShort(ObjectInputStream.java:2753)
    at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:777)
    at java.io.ObjectInputStream.<init>(ObjectInputStream.java:277)
    at org.apache.catalina.util.CustomObjectInputStream.<init>(CustomObjectInputStream.java:96)
    at org.apache.catalina.session.StandardManager.doLoad(StandardManager.java:364)
    at org.apache.catalina.session.StandardManager.load(StandardManager.java:317)
    at org.apache.catalina.session.StandardManager.start(StandardManager.java:642)
    at org.apache.catalina.core.ContainerBase.setManager(ContainerBase.java:448)
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:4665)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:803)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:780)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:583)
    at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1080)
    at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:1003)
    at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:507)
    at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1322)
    at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:325)
    at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:142)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1069)
    at org.apache.catalina.core.StandardHost.start(StandardHost.java:822)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1061)
    at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)
    at org.apache.catalina.core.StandardService.start(StandardService.java:525)
    at org.apache.catalina.core.StandardServer.start(StandardServer.java:759)
    at org.apache.catalina.startup.Catalina.start(Catalina.java:595)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)

 

 

错误的原因是:EOFException表示输入过程中意外地到达文件尾或流尾的信号,导致从session中获取数据失败。这是由于tomcat上次非正常关闭时有一些活动session被持久化(表现为一些临时文件),在重启时,tomcat尝试去恢复这些session的持久化数据但又读取失败造成的。此异常不影响系统的使用。

 

可以看到,我正在使用的msuncityportal项目中多了一个sessions.ser文件,把此文件删除即可tomcat即可正常的使用.

如果你的项目中不知道是哪个项目引起的.就把Catalina目录下的所有文件删除,即可.

以上是关于tomcat启动时报:IOException while loading persisted sessions: java.io.EOFException的解决方案的主要内容,如果未能解决你的问题,请参考以下文章

Tomcat启动时报内存溢出无法正常启动

用Eclipse的tomcat插件启动tomcat时报错:

tomcat启动时报错

idea中tomcat启动时报错

Tomcat在启动时报1099端口被占用的解决办法

tomcat启动时报以下三个严重错误