开发环境中,程序部署在weblogic服务器,而正式环境中需要部署在tomcat下,原本在weblogic下测好的系统,跑在tomcat中时出现如下问题:
1、tomcat console报错:Error: org.hibernate.SessionException: Session is closed
原因是在web.xml中做了如下配置:
<filter>
<filter-name>hibernateFilter</filter-name>
<filter-class>org.springframework.orm.hibernate3.support.OpenSessionInViewFilter</filter-class>
<init-param>
<param-name>singleSession</param-name>
<param-value>true</param-value>
</init-param>
</filter>
这里的singleSession为true,而在程序中又使用到了session.close()方法,所以报错,而这在weblogic中没有问题。
解决办法:把程序中用到的session.close()方法的地方都注视掉。
2、jsp页面打开为空白
原因如下:jsp页面中,之前写的是 <%@ page contentType="text/html