开发环境中,程序部署在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"; pageEncoding="GBK"%>
改为 <%@ page language="java" contentType="text/html; charset=GBK"%> 后便可正常显示,同样,这在weblogic中也无任何问题。
3、也是jsp页面显示问题。
由于在jsp中用到了include命令,而被包含文件的路径为../xxx.jsp,正是因为这里的 ../ 导致被包含文件不能正常显示,以至于这个jsp页面都无法正常显示。
包含文件和被包含文件都位于程序包根目录中,在weblogic下用../没有问题,但在tomcat下就不行。
4、关于"/" 路径问题
有的页面无法显示,还和 / 有关,weblogic中需要 / ,但tomcat中可能不需要,这点也要注意。