failed to lazily initialize a collection of role - 全栈笔记

failed to lazily initialize a collection of role

任亦伟 JAVA, 异常 2015-03-11 172 次浏览 没有评论

WebService编程时出现:failed to lazily initialize a collection of role;the owning Session was closed

我在SSH框架的系统中整合了Apache CXF ,并在WebService的类中注入了service,打断点进行调试,发现数据已经获取到了,但是响应的xml却报了错。后来看了一下,发现自己的OpenSessionInViewFilter过滤器配置的url只针对struts的action后缀,修改后问题解决:

1
<filter>
2
    <filter-name>OpenSessionInViewFilter</filter-name>
3
    <filter-class>org.springframework.orm.hibernate3.support.OpenSessionInViewFilter</filter-class>
4
  </filter>
5
<filter-mapping>
6
    <filter-name>OpenSessionInViewFilter</filter-name>
7
    <url-pattern>/*</url-pattern>
8
  </filter-mapping>

发表评论

回顶部