Exception loading sessions from persistent storage

http://stackoverflow.com/questions/20622746/exception-loading-sessions-from-persistent-storage
java


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. web

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: express

<!-- 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. apache

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. tomcat


只須要修改tomcat目錄下  conf下 context.xml。 session


<?xml version='1.0' encoding='utf-8'?>
<!--
  Licensed to the Apache Software Foundation (ASF) under one or more
  contributor license agreements.  See the NOTICE file distributed with
  this work for additional information regarding copyright ownership.
  The ASF licenses this file to You under the Apache License, Version 2.0
  (the "License"); you may not use this file except in compliance with
  the License.  You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
-->
<!-- The contents of this file will be loaded for each web application -->
<Context>

    <!-- Default set of monitored resources -->
    <WatchedResource>WEB-INF/web.xml</WatchedResource>
    <!-- Uncomment this to disable session persistence across Tomcat restarts -->
    <!--
    <Manager pathname="" />
    -->

    <!-- Uncomment this to enable Comet connection tacking (provides events
         on session expiration as well as webapp lifecycle) -->
    <!--
    <Valve className="org.apache.catalina.valves.CometConnectionManagerValve" />
    -->

</Context>



改爲下邊這樣:
<?xml version='1.0' encoding='utf-8'?>
<!--
  Licensed to the Apache Software Foundation (ASF) under one or more
  contributor license agreements.  See the NOTICE file distributed with
  this work for additional information regarding copyright ownership.
  The ASF licenses this file to You under the Apache License, Version 2.0
  (the "License"); you may not use this file except in compliance with
  the License.  You may obtain a copy of the License at


      http://www.apache.org/licenses/LICENSE-2.0


  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
-->
<!-- The contents of this file will be loaded for each web application -->
<Context>


    <!-- Default set of monitored resources -->
    <WatchedResource>WEB-INF/web.xml</WatchedResource>
    <!-- Uncomment this to disable session persistence across Tomcat restarts -->


    <Manager pathname="" />




    <!-- Uncomment this to enable Comet connection tacking (provides events
         on session expiration as well as webapp lifecycle) -->
    <!--
    <Valve className="org.apache.catalina.valves.CometConnectionManagerValve" />
    -->


</Context>


下邊是百度的結果 app

嚴重: Exception loading sessions from persistent storage 
java.io.EOFException less

刪除Tomcat裏面的work/Catalina/localhost下的內容便可解決 webapp


Tomcat在啓動時出現以下異常問題: ide

嚴重: IOException while loading persisted sessions: java.io.EOFException
嚴重: Exception loading sessions from persistent storage

是由於保存在硬盤上的session數據讀取失敗,問題彷佛不大,可是若是不處理一下,每次啓動都會出現這個問題,處理方法以下:

將work下面的文件清空,主要是*.ser文件,或者只是刪除掉session.ser亦可。

 

 

錯誤描述:....while loading persisted sessions: java.io.EOFException...  分析:EOFException表示輸入過程當中意外地到達文件尾或流尾的信號,致使從session中獲取數據失敗。異常是tomcat自己的問題,因爲tomcat上次非正常關閉時有一些活動session被持久化(表現爲一些臨時文件),在重啓時,tomcat嘗試去恢復這些session的持久化數據但又讀取失敗形成的。此異常不影響系統的使用。

相關文章
相關標籤/搜索