我今天在整合spring3+hibernate4+Struts2,在测试注册页面的时候,老是报这个异常:org.hibernate.HibernateException: No Session found for current thread,session未打开,经过一番测试,可能有一下原因:
1、在Hibernate.cfg.xml中加上配置:
<property name="current_session_context_class">org.springframework.orm.hibernate4.SpringSessionContext</property>
2、在web.xml中加上OpenInViewFilter过滤器
<!-- OpenInViewFilter -->
<filter>
<filter-name>OpenSessionInViewFilter</filter-name>
<filter-class>org.springframework.orm.