今天遇到一个
Exception thrown by getter for property ** of bean ***
的问题,查了半天还是找不到问题,其实应该从提示信息着手,因为其他同样的页面没有问题,单单一个页面出现问题,后来查数据库发现该页面关联的某页面在数据库中的某一个表中没有数据。。汗了一地。。。
其他相关的解决方法:
1,
配置hibernate文件
http://hi.baidu.com/200770842223/item/830e16dcb8b8fe57d73aae11
2,
解决方法:
可以在web.xml中配置一个openSesseionInViewFilter过滤器
配置如下:
<!-- 配置一个OpenSessionInViewFilter的过滤器,用于当用户请求带有延迟加载的数据时,解决lazyInitialization的问题 -->
<filter>
<filter-name>openSessionInViewFilter</filter-name>
<!-- 在referenced Libraries文件夹下的: spring-orm.jar-->
<filter-class>
org.springframework.orm.jdo.support.OpenPersistenceManagerInViewFilter
</filter-class>
</filter>
<filter-mapping>
<filter-name>openSessionInViewFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
问题解决了!
参见 http://xiaoxuejie.iteye.com/blog/791872
本文详细阐述了在使用Spring框架时,遇到Exceptionthrownbygetterforproperty**ofbean***异常的原因及解决方案。通过排查数据库,发现特定页面关联的数据缺失是问题根源。提出了解决方案:配置hibernate文件以优化数据库交互,并在web.xml中配置openSesseionInViewFilter过滤器以解决延迟加载数据引发的问题。问题最终得到解决。
1920

被折叠的 条评论
为什么被折叠?



