could not initialize proxy - no Session
解决方法:
1.不用load方法,使用get方法
2.在web.xml添加
<filter>
<filter-name>openSessionInView</filter-name>
<filter-class>
org.springframework.orm.hibernate3.support.OpenSessionInViewFilter
</filter-class>
</filter>
<filter-mapping>
<filter-name>openSessionInView</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
这个监听器要放在struts的监听器前面。
如果applicationContext.xml中的sessionFactory的名字不是sessionFactory,需做如下配置:
把web.xml中的
<filter>
<filter-name>openSessionInView</filter-name>
<filter-class>
org.springframework.orm.hibernate3.support.OpenSessionInViewFilter
</filter-class>
</filter>
改为:
<filter>
<filter-name>openSessionInView</filter-name>
<filter-class>org.springframework.orm.hibernate3.support.OpenSessionInViewFilter</filter-class>
<init-param>
<param-name>sessionFactoryBeanName</param-name>
<param-value>sf</param-value>
</init-param>
</filter>
您的鼓励,我的动力。
![微信](http://img.my.csdn.net/uploads/201710/15/1508067008_3177.png)
![支付宝](http://img.my.csdn.net/uploads/201710/15/1508067180_1869.jpg)