1. 程式人生 > >tomcat啟動時報:IOException while loading persisted sessions: java.io.EOFException的解決方案 ZT

tomcat啟動時報:IOException while loading persisted sessions: java.io.EOFException的解決方案 ZT

tint fan add ada osi ostc lac important .cn

錯誤代碼如下:  
嚴重: IOException while loading persisted sessions: java.io.EOFException  
java.io.EOFException  
    at java.io.ObjectInputStream$PeekInputStream.readFully(ObjectInputStream.java:2325)  
    at java.io.ObjectInputStream$BlockDataInputStream.readShort(ObjectInputStream.java:2794)  
    at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:801)  
    at java.io.ObjectInputStream.<init>(ObjectInputStream.java:299)  
    at org.apache.catalina.util.CustomObjectInputStream.<init>(CustomObjectInputStream.java:58)  
    at org.apache.catalina.session.StandardManager.doLoad(StandardManager.java:226)  
    at org.apache.catalina.session.StandardManager.load(StandardManager.java:183)  
    at org.apache.catalina.session.StandardManager.startInternal(StandardManager.java:473)  
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)  
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5293)  
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)  
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:726)  
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:702)  
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:698)  
    at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1119)  
    at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1760)  
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)  
    at java.util.concurrent.FutureTask.run(FutureTask.java:262)  
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)  
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)  
    at java.lang.Thread.run(Thread.java:744)  
一月 02, 2014 2:38:27 下午 org.apache.catalina.session.StandardManager startInternal  
嚴重: Exception loading sessions from persistent storage  
java.io.EOFException  
    at java.io.ObjectInputStream$PeekInputStream.readFully(ObjectInputStream.java:2325)  
    at java.io.ObjectInputStream$BlockDataInputStream.readShort(ObjectInputStream.java:2794)  
    at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:801)  
    at java.io.ObjectInputStream.<init>(ObjectInputStream.java:299)  
    at org.apache.catalina.util.CustomObjectInputStream.<init>(CustomObjectInputStream.java:58)  
    at org.apache.catalina.session.StandardManager.doLoad(StandardManager.java:226)  
    at org.apache.catalina.session.StandardManager.load(StandardManager.java:183)  
    at org.apache.catalina.session.StandardManager.startInternal(StandardManager.java:473)  
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)  
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5293)  
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)  
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:726)  
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:702)  
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:698)  
    at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1119)  
    at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1760)  
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)  
    at java.util.concurrent.FutureTask.run(FutureTask.java:262)  
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)  
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)  
    at java.lang.Thread.run(Thread.java:744)  
一月 02, 2014 2:38:27 下午 org.apache.catalina.startup.HostConfig deployDirectory  

  錯誤的原因是:EOFException表示輸入過程中意外地到達文件尾或流尾的信號,導致從session中獲取數據失敗。這是由於tomcat上次非正常關閉時有一些活動session被持久化(表現為一些臨時文件),在重啟時,tomcat嘗試去恢復這些session的持久化數據但又讀取失敗造成的。此異常不影響系統的使用。

技術分享

可以看到,我正在使用的day56項目中多了一個sessions.ser文件,把此文件刪除即可tomcat即可正常的使用.

如果你的項目中不知道是哪個項目引起的.就把Catalina目錄下的所有文件刪除,即可.

  1. 錯誤代碼如下:
  2. 嚴重: IOException while
    loading persisted sessions: java.io.EOFException
  3. java.io.EOFException
  4. at java.io.ObjectInputStream$PeekInputStream.readFully(ObjectInputStream.java:2325)
  5. at java.io.ObjectInputStream$BlockDataInputStream.readShort(ObjectInputStream.java:2794)
  6. at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:801
    )
  7. at java.io.ObjectInputStream.<init>(ObjectInputStream.java:299)
  8. at org.apache.catalina.util.CustomObjectInputStream.<init>(CustomObjectInputStream.java:58)
  9. at org.apache.catalina.session.StandardManager.doLoad(StandardManager.java:226)
  10. at org.apache.catalina.session.StandardManager.load(StandardManager.java:183)
  11. at org.apache.catalina.session.StandardManager.startInternal(StandardManager.java:473)
  12. at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
  13. at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5293)
  14. at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
  15. at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:726)
  16. at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:702)
  17. at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:698)
  18. at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1119)
  19. at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1760)
  20. at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
  21. at java.util.concurrent.FutureTask.run(FutureTask.java:262)
  22. at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
  23. at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
  24. at java.lang.Thread.run(Thread.java:744)
  25. 一月 02, 2014 2:38:27 下午 org.apache.catalina.session.StandardManager startInternal
  26. 嚴重: Exception loading sessions from persistent storage
  27. java.io.EOFException
  28. at java.io.ObjectInputStream$PeekInputStream.readFully(ObjectInputStream.java:2325)
  29. at java.io.ObjectInputStream$BlockDataInputStream.readShort(ObjectInputStream.java:2794)
  30. at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:801)
  31. at java.io.ObjectInputStream.<init>(ObjectInputStream.java:299)
  32. at org.apache.catalina.util.CustomObjectInputStream.<init>(CustomObjectInputStream.java:58)
  33. at org.apache.catalina.session.StandardManager.doLoad(StandardManager.java:226)
  34. at org.apache.catalina.session.StandardManager.load(StandardManager.java:183)
  35. at org.apache.catalina.session.StandardManager.startInternal(StandardManager.java:473)
  36. at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
  37. at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5293)
  38. at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
  39. at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:726)
  40. at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:702)
  41. at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:698)
  42. at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1119)
  43. at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1760)
  44. at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
  45. at java.util.concurrent.FutureTask.run(FutureTask.java:262)
  46. at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
  47. at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
  48. at java.lang.Thread.run(Thread.java:744)
  49. 一月 02, 2014 2:38:27 下午 org.apache.catalina.startup.HostConfig deployDirectory

tomcat啟動時報:IOException while loading persisted sessions: java.io.EOFException的解決方案 ZT