您的位置:首页 > 编程语言 > Java开发

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>

问题解决;
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐