应用程序的环境是tomcat6.0,struts1.3,spring2.0,hibernate3.2(好像是)异常信息如下:
org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role:
com.ssh.person.bean.Teacher.students, no session or session was closed配置如下(在struts的前面:)
<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>*.do</url-pattern>
</filter-mapping>
事务的:
<bean id="hbTransactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
...
</bean><tx:advice id="tsConfig" transaction-manager="hbTransactionManager">
<tx:attributes>
<tx:method name="add" propagation="SUPPORTS" read-only="true"/>
<tx:method name="gets" propagation="SUPPORTS" read-only="true"/>
<tx:method name="*" propagation="REQUIRED"/>
</tx:attributes>
</tx:advice>

<aop:config>
<aop:pointcut id="bizMethods" expression="execution(* com.ssh.person.service.impl.*.*(..))"/>
<aop:advisor advice-ref="tsConfig" pointcut-ref="bizMethods"/>
</aop:config>说明一下:我用lazy="false"模式测试过页面是可以正常访问的。
此问题困扰了我好久好久,只能求助各路大虾。救我一命,造你七级浮屠...膜拜!!!