tomcat 异常 Exception loading sessions from persistent storag

启动 Tomcat时出现session persistence问题,抛出类似如下异常信息:
ERROR:IOException while loading persisted sessions: java.io.WriteAbortedException: writing aborted;
ERROR: Exception loading sessions from persistent storage

可尝试办法:
修改Tomcat\conf\server.xml,添加如下内容
<context></context>
<manager classname="org.apache.catalina.session.PersistentManager" saveonrestart="false"></manager>

参考原因:在Session里面放置了com.abc.UserBean对象,这个类也没有实现java.io.Serializable。
User authentication information is stored both in the users's session data and in the context of a server or virtual host that is targeted by a Web Application. Using the session.invalidate() method, which is often used to log out a user, only invalidates the current session for a user—the user's authentication information still remains valid and is stored in the context of the server or virtual host. If the server or virtual host is hosting only one Web Application, the session.invalidate()method, in effect, logs out the user.

 

J2ee的session并没有要求session attribute必须要Serializable呀。原来这是tomcat 5的新功能,服务复位后自动恢复session

如果要禁用这一特性,到apache-tomcat/conf/Catalina/localhost目录下找到webapp同名的xml,修改成:

 <Context path="..." reloadable="..." docBase="..." workDir="..."> 
<Manager className="org.apache.catalina.session.PersistentManager" saveOnRestart="false"/> 
</Context> 
 

你可能感兴趣的:(apache,tomcat,Web,xml,idea)