问题如下:
java.io.FileNotFoundException: E:apache-tomcat-8.0.37workCatalinalocalhost20161013ShoppingCartSESSIONS.ser (系统找不到指定的路径。)
at java.io.FileOutputStream.open0(Native Method)
at java.io.FileOutputStream.open(FileOutputStream.java:270)
at java.io.FileOutputStream.<init>(FileOutputStream.java:213)
at java.io.FileOutputStream.<init>(FileOutputStream.java:101)
at org.apache.catalina.session.StandardManager.doUnload(StandardManager.java:299)
at org.apache.catalina.session.StandardManager.unload(StandardManager.java:265)
at org.apache.catalina.session.StandardManager.stopInternal(StandardManager.java:384)
at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:221)
at org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5533)
at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:221)
at org.apache.catalina.core.ContainerBase.removeChild(ContainerBase.java:821)
at org.apache.catalina.startup.HostConfig.undeploy(HostConfig.java:1395)
at org.apache.catalina.startup.HostConfig.checkResources(HostConfig.java:1321)
at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1581)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:284)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:95)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1140)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1376)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1380at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1348)
at java.lang.Thread.run(Thread.java:745)
症状原因:
(1) Tomcat/work/Catalina/localhost/工程名/SESSIONS.ser
session未超时的情况下服务器关闭的时候被序列化为工程名/SESSIONS.ser 启动的时候再加载进来,加载的时候报错了
(2)tomcat 启动的问题(org.apache.catalina.session.StandardManager.doLoad: IOException
while loading persisted sessions)
大概是说tomcat上次关闭时还有一些活动连接,所以在重启时tomcat尝试去恢复这些session造成的。 tomcat的work目录下面的东西删一遍。
解决办法:
把Eclipse关闭,再重新打开运行,没有问题。