It all started when I tried to lazy load a associated object. I have my app
fully integrated with struts, spring and hibernate.

Use Case:
I call a simple action, in my action class, I get the business object
through the dao which has spring transaction boundaries set.
In my jsp .... I get the associated list ...
myBusinessObject.getLazyLoadAssociatedList(),
it error outs says session closed.

So I configured the cool filter OpenSessionInViewFilter in web.xml. and I am
still not able to fix the problem.

When I debug ..... looks like the OpenSessionInViewFilter keeps the session
open after the jsp is painted. I don't understand why
the session is not kept open around the actual action method executed.

following is the web.xml configuration.

<!-- Define all the filters here -->
   <filter>
       <filter-name>struts</filter-name>
       
<filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
   </filter>

   <filter>
       <filter-name>sitemesh</filter-name>
       
<filter-class>com.opensymphony.module.sitemesh.filter.PageFilter</filter-class>

     </filter>

   <filter>
       <filter-name>lazyLoadingFilter</filter-name>
        <filter-class>
org.springframework.orm.hibernate3.support.OpenSessionInViewFilter</filter-class>

   </filter>

   <filter>
       <filter-name>struts-cleanup</filter-name>
       
<filter-class>org.apache.struts2.dispatcher.ActionContextCleanUp</filter-class>

   </filter>

   <filter>
       <filter-name>rewriteFilter</filter-name>
       
<filter-class>org.tuckey.web.filters.urlrewrite.UrlRewriteFilter</filter-class>

          <init-param>
              <param-name>logLevel</param-name>
           <param-value>commons</param-value>
         </init-param>
     </filter>



   <!-- Define all the filter mappings here -->
    <filter-mapping>
       <filter-name>struts-cleanup</filter-name>
       <url-pattern>/*</url-pattern>
   </filter-mapping>

    <filter-mapping>
       <filter-name>sitemesh</filter-name>
       <url-pattern>/*</url-pattern>
       <!--dispatcher>FORWARD</dispatcher-->
   </filter-mapping>

   <filter-mapping>
       <filter-name>struts</filter-name>
       <url-pattern>/*</url-pattern>
   </filter-mapping>
  <filter-mapping>
       <filter-name>rewriteFilter</filter-name>
       <url-pattern>/*</url-pattern>
   </filter-mapping>

   <filter-mapping>
       <filter-name>lazyLoadingFilter</filter-name>
       <url-pattern>/*</url-pattern>
   </filter-mapping>


I also tried all the combinations of moving around the filters (order)....

FINE    03/07/2007 08:18:30 AM [
TransactionSynchronizationManager.unbindResource ()] Removed value [
[EMAIL PROTECTED] for key [
[EMAIL PROTECTED] from thread [[ACTIVE]
ExecuteThread: '2' for queue: 'weblogic.kernel.Default (self-tuning)']
FINE    03/07/2007 08:18:30 AM [
TransactionSynchronizationManager.unbindResource()] Removed value [
[EMAIL PROTECTED] for key [
[EMAIL PROTECTED]
from thread [[ACTIVE] ExecuteThread: '2' for queue: '
weblogic.kernel.Default (self-tuning)']
FINE    03/07/2007 08:18:30 AM [
HibernateTransactionManager.doCleanupAfterCompletion()] Closing Hibernate
Session [ [EMAIL PROTECTED] after transaction
FINE    03/07/2007 08:18:30 AM [SessionFactoryUtils.closeSession()] Closing
Hibernate Session
FINEST  03/07/2007 08:18:30 AM [SessionImpl.close()] closing session
FINEST  03/07/2007 08:18:30 AM [ConnectionManager.cleanup()] performing
cleanup
FINE    03/07/2007 08:18:30 AM [ConnectionManager.closeConnection()]
releasing JDBC connection [ (open PreparedStatements: 0, globally: 0) (open
ResultSets: 0, globally: 0)]
SQLLog: ([ACTIVE] ExecuteThread: '2' for queue:
'weblogic.kernel.Default(self-tuning)'@c=a0a058) close()
(close) elapse ms=0
FINEST  03/07/2007 08:18:30 AM [JDBCContext.afterTransactionCompletion ()]
after transaction completion
FINE    03/07/2007 08:18:30 AM [ConnectionManager.afterTransaction()]
transaction completed on session with on_close connection release mode; be
sure to close the session to release JDBC resources!
FINEST  03/07/2007 08:18:30 AM [SessionImpl.afterTransactionCompletion()]
after transaction completion
FINEST  03/07/2007 08:18:30 AM [DefaultListableBeanFactory.getBeanDefinition()]
No bean named 'org.apache.struts2.dispatcher.ServletDispatcherResult ' found
in org.springframework.beans.factory.support.DefaultListableBeanFactorydefining
beans
[propertyConfigurer,newDealJCL,servicerJCL,dataSource,hibernateAuditListener,sessionFactory,hibernateConfiguration,databaseConnection,hibernateConnection,transactionManager,schemaName,
org.springframework.aop.config.internalAutoProxyCreator,allESSDaos,
org.springframework.aop.support.DefaultBeanFactoryPointcutAdvisor,txAdvice,dao,targetedServicersDAO,workflowDAO,allocationDAO,userAuditDAO,userAuditHistoryDAO,auditDAO,loanReconciliationDAO,loanReconciliationDifferenceDAO,loanAssumabilityDAO,lenderVarianceDAO,loanToPseudopoolDAO,pseudopoolDAO,activeUserLogger,auditLogLogger,superLoanDAO,systemPropertyDAO,comminglingRuleStatusDAO,comminglingRuleResultDAO,trancheDAO,attributeLoader,enumMapper,ftpSupport,servicerJobSubmissionManager,newDealJobSubmissionManager,ftpSessionProfile,valueTransformerFactory,groupingJavaXmlBindingFactory,superLoanSpecificationReader,superLoanNaturalKeyBuilder,groupingManager,groupingMethods,
org.springframework.aop.support.DefaultBeanFactoryPointcutAdvisor#1
,targetedServicerManager,targetedServicerMethods,
org.springframework.aop.support.DefaultBeanFactoryPointcutAdvisor#2,loanReconciliationManager,lenderLoanDeleter,fannieMaeLoanDeleter,trancheCleanUpManager,lenderLoanFileChunkProcessor,fannieMaeLoanFileChunkProcessor,
org.springframework.transaction.interceptor.TransactionAttributeSourceAdvisor,passwordManager,lastLoginFinder,ramConfiguration,authentication,ramAcessReport];
root of BeanFactory hierarchy
FINEST  03/07/2007 08:18:30 AM [ CollectionFactory.createLinkedMapIfPossible()]
Creating [java.util.LinkedHashMap]
FINEST  03/07/2007 08:18:30 AM [CollectionFactory.createLinkedMapIfPossible()]
Creating [java.util.LinkedHashMap]
FINEST  03/07/2007 08:18:30 AM [ ConstructorResolver.autowireConstructor()]
Ignoring constructor [public
org.apache.struts2.dispatcher.ServletDispatcherResult(java.lang.String)] of
bean 'org.apache.struts2.dispatcher.ServletDispatcherResult':
org.springframework.beans.factory.UnsatisfiedDependencyException : Error
creating bean with name '
org.apache.struts2.dispatcher.ServletDispatcherResult': Unsatisfied
dependency expressed through constructor argument with index 0 of type [
java.lang.String]: There are 0 beans of type [ java.lang.String] available
for autowiring: []. There should have been exactly 1 to be able to autowire
constructor of bean 'org.apache.struts2.dispatcher.ServletDispatcherResult'.
FINEST  03/07/2007 08:18:30 AM [ CachedIntrospectionResults.forClass()]
Using cached introspection results for class [
org.apache.struts2.dispatcher.ServletDispatcherResult]
FINE    03/07/2007 08:18:30 AM [ConstructorResolver.autowireConstructor()]
Bean ' org.apache.struts2.dispatcher.ServletDispatcherResult' instantiated
via constructor [public
org.apache.struts2.dispatcher.ServletDispatcherResult()]
FINEST  03/07/2007 08:18:30 AM [
AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization()]
Invoking BeanPostProcessors before initialization of bean '
org.apache.struts2.dispatcher.ServletDispatcherResult'
FINEST  03/07/2007 08:18:30 AM [
AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsAfterInitialization()]
Invoking BeanPostProcessors after initialization of bean '
org.apache.struts2.dispatcher.ServletDispatcherResult'
FINEST  03/07/2007 08:18:30 AM [CachedIntrospectionResults.forClass()] Using
cached introspection results for class [
org.apache.struts2.dispatcher.ServletDispatcherResult]
FINE    03/07/2007 08:18:30 AM [ActionContextCleanUp.cleanUp()] skipping
cleanup counter=1
FINE    03/07/2007 08:18:30 AM [BrowserDetectBean.<init>()]
BrowserDetectBean(): User Agent <Mozilla/5.0 (Windows; U; Windows NT 5.1;
en-US; rv:1.8.1.2) Gecko/20070219 Firefox/2.0.0.2>.
FINE    03/07/2007 08:18:30 AM [BrowserDetectBean.<init>()] Operating System
<Windows>.
FINE    03/07/2007 08:18:30 AM [BrowserDetectBean.<init>()] Browser Type
<Netscape>.
FINE    03/07/2007 08:18:30 AM [BrowserDetectBean.<init>()] Browser Version
<5>.
FINE    03/07/2007 08:18:30 AM [BrowserDetectBean.<init>()]
BrowserDetectBean(): End.
FINE    03/07/2007 08:18:30 AM [ UIBean.mergeTemplate()] Rendering template
/template/simple/form
FINE    03/07/2007 08:18:30 AM [FreemarkerTemplateEngine.renderTemplate()]
Rendering template /template/simple/form.ftl
FINE    03/07/2007 08:18:30 AM [ UIBean.mergeTemplate()] Rendering template
/template/simple/form-close
FINE    03/07/2007 08:18:30 AM [FreemarkerTemplateEngine.renderTemplate()]
Rendering template /template/simple/form-close.ftl
FINE    03/07/2007 08:18:30 AM [
TransactionSynchronizationManager.unbindResource()] Removed value [
[EMAIL PROTECTED] for key [
[EMAIL PROTECTED] from thread [[ACTIVE]
ExecuteThread: '2' for queue: ' weblogic.kernel.Default (self-tuning)']
FINE    03/07/2007 08:18:30 AM [
TransactionSynchronizationManager.unbindResource()] Removed value [
[EMAIL PROTECTED] for key [
[EMAIL PROTECTED]
from thread [[ACTIVE] ExecuteThread: '2' for queue: '
weblogic.kernel.Default (self-tuning)']
FINE    03/07/2007 08:18:30 AM [
HibernateTransactionManager.doCleanupAfterCompletion()] Closing Hibernate
Session [ [EMAIL PROTECTED] after transaction
FINE    03/07/2007 08:18:30 AM [SessionFactoryUtils.closeSession()] Closing
Hibernate Session
FINEST  03/07/2007 08:18:30 AM [SessionImpl.close()] closing session
FINEST  03/07/2007 08:18:30 AM [ConnectionManager.cleanup()] performing
cleanup
FINE    03/07/2007 08:18:30 AM [ConnectionManager.closeConnection()]
releasing JDBC connection [ (open PreparedStatements: 0, globally: 0) (open
ResultSets: 0, globally: 0)]
SQLLog: ([ACTIVE] ExecuteThread: '2' for queue:
'weblogic.kernel.Default(self-tuning)'@c=a0a058) close()
(close) elapse ms=0
FINEST  03/07/2007 08:18:30 AM [JDBCContext.afterTransactionCompletion ()]
after transaction completion
FINE    03/07/2007 08:18:30 AM [ConnectionManager.afterTransaction()]
transaction completed on session with on_close connection release mode; be
sure to close the session to release JDBC resources!
FINEST  03/07/2007 08:18:30 AM [SessionImpl.afterTransactionCompletion()]
after transaction completion
FINEST  03/07/2007 08:18:30 AM [DefaultListableBeanFactory.getBeanDefinition()]
No bean named 'org.apache.struts2.dispatcher.ServletDispatcherResult ' found
in org.springframework.beans.factory.support.DefaultListableBeanFactorydefining
beans
[propertyConfigurer,newDealJCL,servicerJCL,dataSource,hibernateAuditListener,sessionFactory,hibernateConfiguration,databaseConnection,hibernateConnection,transactionManager,schemaName,
org.springframework.aop.config.internalAutoProxyCreator,allESSDaos,
org.springframework.aop.support.DefaultBeanFactoryPointcutAdvisor,txAdvice,dao,targetedServicersDAO,workflowDAO,allocationDAO,userAuditDAO,userAuditHistoryDAO,auditDAO,loanReconciliationDAO,loanReconciliationDifferenceDAO,loanAssumabilityDAO,lenderVarianceDAO,loanToPseudopoolDAO,pseudopoolDAO,activeUserLogger,auditLogLogger,superLoanDAO,systemPropertyDAO,comminglingRuleStatusDAO,comminglingRuleResultDAO,trancheDAO,attributeLoader,enumMapper,ftpSupport,servicerJobSubmissionManager,newDealJobSubmissionManager,ftpSessionProfile,valueTransformerFactory,groupingJavaXmlBindingFactory,superLoanSpecificationReader,superLoanNaturalKeyBuilder,groupingManager,groupingMethods,
org.springframework.aop.support.DefaultBeanFactoryPointcutAdvisor#1
,targetedServicerManager,targetedServicerMethods,
org.springframework.aop.support.DefaultBeanFactoryPointcutAdvisor#2,loanReconciliationManager,lenderLoanDeleter,fannieMaeLoanDeleter,trancheCleanUpManager,lenderLoanFileChunkProcessor,fannieMaeLoanFileChunkProcessor,
org.springframework.transaction.interceptor.TransactionAttributeSourceAdvisor,passwordManager,lastLoginFinder,ramConfiguration,authentication,ramAcessReport];
root of BeanFactory hierarchy
FINEST  03/07/2007 08:18:30 AM [ CollectionFactory.createLinkedMapIfPossible()]
Creating [java.util.LinkedHashMap]
FINEST  03/07/2007 08:18:30 AM [CollectionFactory.createLinkedMapIfPossible()]
Creating [java.util.LinkedHashMap]
FINEST  03/07/2007 08:18:30 AM [ ConstructorResolver.autowireConstructor()]
Ignoring constructor [public
org.apache.struts2.dispatcher.ServletDispatcherResult(java.lang.String)] of
bean 'org.apache.struts2.dispatcher.ServletDispatcherResult':
org.springframework.beans.factory.UnsatisfiedDependencyException : Error
creating bean with name '
org.apache.struts2.dispatcher.ServletDispatcherResult': Unsatisfied
dependency expressed through constructor argument with index 0 of type [
java.lang.String]: There are 0 beans of type [ java.lang.String] available
for autowiring: []. There should have been exactly 1 to be able to autowire
constructor of bean 'org.apache.struts2.dispatcher.ServletDispatcherResult'.
FINEST  03/07/2007 08:18:30 AM [ CachedIntrospectionResults.forClass()]
Using cached introspection results for class [
org.apache.struts2.dispatcher.ServletDispatcherResult]
FINE    03/07/2007 08:18:30 AM [ConstructorResolver.autowireConstructor()]
Bean ' org.apache.struts2.dispatcher.ServletDispatcherResult' instantiated
via constructor [public
org.apache.struts2.dispatcher.ServletDispatcherResult()]
FINEST  03/07/2007 08:18:30 AM [
AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization()]
Invoking BeanPostProcessors before initialization of bean '
org.apache.struts2.dispatcher.ServletDispatcherResult'
FINEST  03/07/2007 08:18:30 AM [
AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsAfterInitialization()]
Invoking BeanPostProcessors after initialization of bean '
org.apache.struts2.dispatcher.ServletDispatcherResult'
FINEST  03/07/2007 08:18:30 AM [CachedIntrospectionResults.forClass ()]
Using cached introspection results for class [
org.apache.struts2.dispatcher.ServletDispatcherResult]
FINE    03/07/2007 08:18:30 AM [ServletDispatcherResult.doExecute()]
Forwarding to location /pages/reports/popup/failedRconAttrs.jsp
SEVERE  03/07/2007 08:18:30 AM [LazyInitializationException.<init>()] failed
to lazily initialize a collection of role:
com.xyz.customersolutions.ess.modelobject.LoanReconciliation.failedRconAttrs,
no session or session was closed
FINE    03/07/2007 08:18:30 AM [ActionContextCleanUp.cleanUp()] skipping
cleanup counter=1
FINE    03/07/2007 08:18:30 AM [BrowserDetectBean.<init>()]
BrowserDetectBean(): User Agent <Mozilla/5.0 (Windows; U; Windows NT 5.1;
en-US; rv:1.8.1.2) Gecko/20070219 Firefox/2.0.0.2>.
FINE    03/07/2007 08:18:30 AM [BrowserDetectBean.<init>()] Operating System
<Windows>.
FINE    03/07/2007 08:18:30 AM [BrowserDetectBean.<init>()] Browser Type
<Netscape>.
FINE    03/07/2007 08:18:30 AM [BrowserDetectBean.<init>()] Browser Version
<5>.
FINE    03/07/2007 08:18:30 AM [BrowserDetectBean.<init>()]
BrowserDetectBean(): End.
FINE    03/07/2007 08:18:30 AM [ UIBean.mergeTemplate()] Rendering template
/template/simple/form
FINE    03/07/2007 08:18:30 AM [FreemarkerTemplateEngine.renderTemplate()]
Rendering template /template/simple/form.ftl
FINE    03/07/2007 08:18:30 AM [ UIBean.mergeTemplate()] Rendering template
/template/simple/form-close
FINE    03/07/2007 08:18:30 AM [FreemarkerTemplateEngine.renderTemplate()]
Rendering template /template/simple/form-close.ftl
FINE    03/07/2007 08:18:30 AM [OpenSessionInViewFilter.lookupSessionFactory()]
Using SessionFactory 'sessionFactory' for OpenSessionInViewFilter
FINE    03/07/2007 08:18:30 AM [AbstractBeanFactory.getBean ()] Returning
cached instance of singleton bean 'sessionFactory'
FINEST  03/07/2007 08:18:30 AM [AbstractBeanFactory.getObjectForBeanInstance()]
Bean with name 'sessionFactory' is a factory bean
FINE    03/07/2007 08:18:30 AM [ OpenSessionInViewFilter.doFilterInternal()]
Opening single Hibernate Session in OpenSessionInViewFilter
FINE    03/07/2007 08:18:30 AM [SessionFactoryUtils.doGetSession()] Opening
Hibernate Session
FINE    03/07/2007 08:18:30 AM [SessionImpl.<init>()] opened session at
timestamp: 11732735109
FINEST  03/07/2007 08:18:30 AM [SessionImpl.setFlushMode()] setting flush
mode to: NEVER
FINE    03/07/2007 08:18:30 AM [
TransactionSynchronizationManager.bindResource()] Bound value [
[EMAIL PROTECTED] ] for key [
[EMAIL PROTECTED] to thread [[ACTIVE]
ExecuteThread: '2' for queue: 'weblogic.kernel.Default (self-tuning)']
FINE    03/07/2007 08:18:30 AM [
TransactionSynchronizationManager.unbindResource ()] Removed value [
[EMAIL PROTECTED] for key [
[EMAIL PROTECTED] from thread [[ACTIVE]
ExecuteThread: '2' for queue: 'weblogic.kernel.Default (self-tuning)']
FINE    03/07/2007 08:18:30 AM [OpenSessionInViewFilter.doFilterInternal()]
Closing single Hibernate Session in OpenSessionInViewFilter
FINE    03/07/2007 08:18:30 AM [ SessionFactoryUtils.closeSession()] Closing
Hibernate Session
FINEST  03/07/2007 08:18:30 AM [SessionImpl.close()] closing session
FINEST  03/07/2007 08:18:30 AM [ConnectionManager.cleanup()] connection
already null in cleanup : no action

Reply via email to