springmvc No Hibernate Session bound to thread
2015-04-04 19:51
330 查看
最近整合springmvc 发现一个离奇的报错,No Hibernate Session bound to thread,
and configuration does not allow creation,就是这丫,之前在单元测试的时候测试sessionFactory,测试transaction都通过,正当我happy 的跑去做action的时候,这丫来个晴天霹雳啊.......没有一点点防备,也没有一丝顾虑,他就这样出现,在我的代码里。。。。。。。。因为在之前整合s2sh的时候从来没出现过,各种goole,百度。。。。。倒是好多大神也出现这错,但是出现的解决方法都不一样。。。不可信,果断进入spring官网查查文档,出现了一个哥没见过的东东,它需要在web.xml里面定义一个filter
废话少说,直接上:
<filter>
<filter-name>openSessionInViewFilter</filter-name>
<filter-class>
org.springframework.orm.hibernate3.support.OpenSessionInViewFilter
</filter-class>
</filter>
<filter-mapping>
<filter-name>openSessionInViewFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
问题解决;
and configuration does not allow creation,就是这丫,之前在单元测试的时候测试sessionFactory,测试transaction都通过,正当我happy 的跑去做action的时候,这丫来个晴天霹雳啊.......没有一点点防备,也没有一丝顾虑,他就这样出现,在我的代码里。。。。。。。。因为在之前整合s2sh的时候从来没出现过,各种goole,百度。。。。。倒是好多大神也出现这错,但是出现的解决方法都不一样。。。不可信,果断进入spring官网查查文档,出现了一个哥没见过的东东,它需要在web.xml里面定义一个filter
废话少说,直接上:
<filter>
<filter-name>openSessionInViewFilter</filter-name>
<filter-class>
org.springframework.orm.hibernate3.support.OpenSessionInViewFilter
</filter-class>
</filter>
<filter-mapping>
<filter-name>openSessionInViewFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
问题解决;
相关文章推荐
- spring hibernate No Hibernate Session bound to thread异常
- spring 管理事务配置时,结果 报错: No Hibernate Session bound to thread, and configuration does not allow creation of non-transactional one here这个异常
- No Hibernate Session bound to thread, and configuration does not allow creation of non-transactiona
- No Hibernate Session bound to thread, and configuration does not allow create解决方案
- No Hibernate Session bound to thread, and configuration does not allow creation of non-transactiona
- org.hibernate.HibernateException: No Hibernate Session bound to thread, and configuration does not a
- java开源框架集成常见错误之No Hibernate Session bound to thread
- org.hibernate.HibernateException: No Hibernate Session bound to thread, and configuration does not
- No Hibernate Session bound to thread, and configuration does not allow creation of non-transactional
- No Hibernate Session bound to thread, and configuration does not allow creation of non-transactional
- No Hibernate Session bound to thread, and configuration does not allow creation of non-transactiona
- 解决一个Sping管理hibernate时的事务问题(No Hibernate Session bound to thread)
- hibernate错误提示: No Hibernate Session bound to thread, and configuration does not allow creation of no
- No Hibernate Session bound to thread纠结了很久
- org.hibernate.HibernateException: No Hibernate Session bound to thread, and configuration does not a
- 继承类的@Transactional:org.hibernate.HibernateException: No Hibernate Session bound to thread, and configuration does not allow creation of non-transactional one here
- No Hibernate Session bound to thread, and configuration does not allow 解决办法
- org.hibernate.HibernateException: No Hibernate Session bound to thread, and configuration does not a
- org.hibernate.HibernateException: No Hibernate Session bound to thread, and
- No Hibernate Session bound to thread, and configuration does not allow