im using:
- Struts for the web context
- Spring for the bussiness contex
- Spring + Hiberante for the data access context
im using ContextLoaderPlugIn to connect struts with spring
<plug-in className="org.springframework.web.struts.ContextL oaderPlugIn">
<set-property property="contextConfigLocation" value="/WEB-INF/presentationContext.xml, /WEB-INF/businessLogicContext.xml, /WEB-INF/dataAccessContext.xml" />
</plug-in>
my data access context is something like this:
<!-- ********** Data Sources ********** -->
<!-- VEPDS -->
<bean id="VEPDS" class="org.springframework.jndi.JndiObjectFactoryB ean">
<property name="jndiName">
<value>java:comp/env/jdbc/vepds</value>
</property>
</bean>
<!-- ********** Session Factory ********** -->
<!-- VEPSF -->
<bean id="VEPSF" class="org.springframework.orm.hibernate.LocalSess ionFactoryBean">
<property name="dataSource">
<ref local="VEPDS" />
</property>
<property name="mappingResources">
<list>
<value>cr/go/ice/vep/dao/hibernate/Caja.hbm.xml</value>
<value>cr/go/ice/vep/dao/hibernate/CuentaBancaria.hbm.xml</value>
<value>cr/go/ice/vep/dao/hibernate/EmisorTarjeta.hbm.xml</value>
<value>cr/go/ice/vep/dao/hibernate/Nota.hbm.xml</value>
<value>cr/go/ice/vep/dao/hibernate/Pago.hbm.xml</value>
<value>cr/go/ice/vep/dao/hibernate/Recaudador.hbm.xml</value>
<value>cr/go/ice/vep/dao/hibernate/Reversion.hbm.xml</value>
</list>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">net.sf.hibernate.dialect.O racle9Dialect</prop>
<!--
<prop key="hibernate.query.substitutions">true=1 false=0</prop>
-->
<prop key="hibernate.show_sql">true</prop>
</props>
</property>
</bean>
<!-- ********** Transaction Manager ********** -->
<!-- VEPTM -->
<bean id="VEPTM" class="org.springframework.orm.hibernate.Hibernate TransactionManager">
<property name="sessionFactory"><ref local="VEPSF"/></property>
</bean>
<!-- ********** Data Access Objects ********** -->
<!-- CajaDAO -->
<bean id="CajaDAO" class="cr.go.ice.vep.dao.hibernate.CajaDAOImpl">
<property name="sessionFactory">
<ref local="VEPSF" />
</property>
</bean>
my business context:
<!-- ********** Bussiness Objects ********** -->
<!-- CajaBO -->
<bean id="CajaBO" class="org.springframework.transaction.interceptor .TransactionProxyFactoryBean">
<property name="transactionManager">
<ref bean="VEPTM" />
</property>
<property name="target">
<ref bean="CajaBOTarget" />
</property>
<property name="transactionAttributes">
<props>
<prop key="agregar*">PROPAGATION_REQUIRED</prop>
<prop key="modificar*">PROPAGATION_REQUIRED</prop>
<prop key="borrar*">PROPAGATION_REQUIRED</prop>
<prop key="obtener*">PROPAGATION_REQUIRED</prop>
</props>
</property>
</bean>
<bean id="CajaBOTarget" class="cr.go.ice.vep.bo.pojo.CajaBOImpl">
<property name="cajaDAO">
<ref bean="CajaDAO" />
</property>
</bean>
i configure the filter in web.xml
<filter>
<filter-name>hibernateFilter</filter-name>
<filter-class>org.springframework.orm.hibernate.support.Op enSessionInViewFilter</filter-class>
</filter>
...
<filter-mapping>
<filter-name>hibernateFilter</filter-name>
<url-pattern>*.do</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>hibernateFilter</filter-name>
<url-pattern>*.jsp</url-pattern>
</filter-mapping>
but when i call a jsp file that list a collection that is lazy loaded i get this error:
Error 500: Filter [hibernateFilter]
the stacktrace is:
[8/18/04 12:08:03:111 CST] 46e73abc OpenSessionIn I org.springframework.orm.hibernate.support.OpenSess ionInViewFilter Initializing filter 'hibernateFilter'
[8/18/04 12:08:03:221 CST] 46e73abc OpenSessionIn I org.springframework.orm.hibernate.support.OpenSess ionInViewFilter Filter 'hibernateFilter' configured successfully
[8/18/04 12:08:04:146 CST] 46e73abc WebGroup E SRVE0026E: [Servlet Error]-[Filter [hibernateFilter]: filter is unavailable.]: java.lang.IllegalStateException: No WebApplicationContext found: no ContextLoaderListener registered?
at org.springframework.web.context.support.WebApplica tionContextUtils.getRequiredWebApplicationContext( WebApplicationContextUtils.java:69)
at org.springframework.orm.hibernate.support.OpenSess ionInViewFilter.lookupSessionFactory(OpenSessionIn ViewFilter.java:186)
at org.springframework.orm.hibernate.support.OpenSess ionInViewFilter.doFilterInternal(OpenSessionInView Filter.java:150)
at org.springframework.web.filter.OncePerRequestFilte r.doFilter(OncePerRequestFilter.java:73)
at com.ibm.ws.webcontainer.filter.FilterInstanceWrapp er.doFilter(FilterInstanceWrapper.java:132)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.d oFilter(WebAppFilterChain.java:71)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispat cher.handleWebAppDispatch(WebAppRequestDispatcher. java:974)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispat cher.dispatch(WebAppRequestDispatcher.java:564)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispat cher.forward(WebAppRequestDispatcher.java:200)
at com.ibm.ws.webcontainer.srt.WebAppInvoker.doForwar d(WebAppInvoker.java:119)
at com.ibm.ws.webcontainer.srt.WebAppInvoker.handleIn vocationHook(WebAppInvoker.java:276)
at com.ibm.ws.webcontainer.cache.invocation.CachedInv ocation.handleInvocation(CachedInvocation.java:71)
at com.ibm.ws.webcontainer.srp.ServletRequestProcesso r.dispatchByURI(ServletRequestProcessor.java:182)
at com.ibm.ws.webcontainer.oselistener.OSEListenerDis patcher.service(OSEListener.java:334)
at com.ibm.ws.webcontainer.http.HttpConnection.handle Request(HttpConnection.java:56)
at com.ibm.ws.http.HttpConnection.readAndHandleReques t(HttpConnection.java:618)
at com.ibm.ws.http.HttpConnection.run(HttpConnection. java:443)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.j ava:672)
i have read all the post in the forum related to OpenSessionInViewFilter ... buy i dont know whats happening ....
what am i doint wrong ???
thanks for your help
Ignacio


Reply With Quote