Announcement Announcement Module
Collapse
No announcement yet.
OpenSessionInView + CMT Session usage Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • OpenSessionInView + CMT Session usage

    I'm using JBoss 3.2.6, Spring 1.1 and Hibernate 2.1.6.

    I'm trying to lazy-load my objects (Hibernate Proxy).
    First I use OpenSessionInViewInterceptor, then I access my objects through local SLSB - with HibernateDAOSupport.
    But I get two different Session objects - one from OSIVI and one from HDS (via HibernateTemplete). So when my object are loaded thorugh HDS, this Session is later closed and I normaly get LazyInitException.

    This "jtaStatus == Status.STATUS_ACTIVE" is true so it lookes inside "Session session = sessionHolder.getSession(jtaTm.getTransaction())" which is null. So it creates new one and binds it to existing SessionHolder via TransactionManager.

    Is there something that I forgot to set? Or how can I achieve that HDS binds to the same Session?

    I am not using any Spring's transaction manager over my DAO object. The SLSB method is marked 'supports'.

    Thanx, Ales

    ----------- log -------------

    2004-10-18 19:13:07,578 DEBUG [org.springframework.web.servlet.DispatcherServlet] Testing handler map [org.springframework.web.servlet.handler.SimpleUrlH andlerMapping@327236] in DispatcherServlet with name 'egida'
    2004-10-18 19:13:07,578 DEBUG [org.springframework.web.servlet.handler.SimpleUrlH andlerMapping] Looking up handler for [/userModuleSelect.htm]
    2004-10-18 19:13:07,578 DEBUG [org.springframework.orm.hibernate.support.OpenSess ionInViewInterceptor] Opening single Hibernate session in OpenSessionInViewInterceptor
    2004-10-18 19:13:07,578 DEBUG [org.springframework.orm.hibernate.SessionFactoryUt ils] Opening Hibernate session
    2004-10-18 19:13:07,578 DEBUG [net.sf.hibernate.impl.SessionImpl] opened session
    2004-10-18 19:13:07,578 DEBUG [org.springframework.transaction.support.Transactio nSynchronizationManager] Bound value [org.springframework.orm.hibernate.SessionHolder@36 bc0a] for key [net.sf.hibernate.impl.SessionFactoryImpl@13e3940] to thread [http-0.0.0.0-8080-Processor22]
    2004-10-18 19:13:07,578 DEBUG [org.springframework.transaction.support.Transactio nSynchronizationManager] Retrieved value [org.springframework.orm.hibernate.SessionHolder@36 bc0a] for key [net.sf.hibernate.impl.SessionFactoryImpl@13e3940] bound to thread [http-0.0.0.0-8080-Processor22]
    2004-10-18 19:13:07,578 DEBUG [net.sf.hibernate.impl.SessionImpl] attempting to resolve [com.generalynx.egida.basic.common.data.User#1]
    2004-10-18 19:13:07,578 DEBUG [net.sf.hibernate.impl.SessionImpl] object not resolved in any cache [com.generalynx.egida.basic.common.data.User#1]
    2004-10-18 19:13:07,578 DEBUG [net.sf.hibernate.persister.EntityPersister] Materializing entity: [com.generalynx.egida.basic.common.data.User#1]
    2004-10-18 19:13:07,578 DEBUG [net.sf.hibernate.impl.BatcherImpl] about to open: 0 open PreparedStatements, 0 open ResultSets
    2004-10-18 19:13:07,578 DEBUG [net.sf.hibernate.SQL] select user0_.euser_id as euser_id0_, user0_.uversion as uversion0_, user0_.name as name0_, user0_.surname as surname0_, user0_.phone as phone0_, user0_.email as email0_, user0_.street as street0_, user0_.city as city0_, user0_.post as post0_, user0_.country as country0_, user0_.username as username0_, user0_.password as password0_, user0_.status_key as status_key0_, user0_.creator_id as creator_id0_, user0_.creation_time as creatio15_0_, user0_.def_module as def_module0_ from euser user0_ where user0_.euser_id=?
    2004-10-18 19:13:07,578 DEBUG [net.sf.hibernate.impl.BatcherImpl] preparing statement
    2004-10-18 19:13:07,578 DEBUG [net.sf.hibernate.type.IntegerType] binding '1' to parameter: 1
    2004-10-18 19:13:07,578 DEBUG [net.sf.hibernate.loader.Loader] processing result set
    2004-10-18 19:13:07,593 DEBUG [net.sf.hibernate.loader.Loader] result row: 1
    2004-10-18 19:13:07,593 DEBUG [net.sf.hibernate.loader.Loader] Initializing object from ResultSet: 1
    2004-10-18 19:13:07,593 DEBUG [net.sf.hibernate.loader.Loader] Hydrating entity: com.generalynx.egida.basic.common.data.User#1
    2004-10-18 19:13:07,593 DEBUG [net.sf.hibernate.type.IntegerType] returning '1' as column: uversion0_
    2004-10-18 19:13:07,593 DEBUG [net.sf.hibernate.type.StringType] returning 'Aleš' as column: name0_
    2004-10-18 19:13:07,593 DEBUG [net.sf.hibernate.type.StringType] returning 'Justin' as column: surname0_
    2004-10-18 19:13:07,593 DEBUG [net.sf.hibernate.type.StringType] returning '0111111' as column: phone0_
    2004-10-18 19:13:07,593 DEBUG [net.sf.hibernate.type.StringType] returning '[email protected]' as column: email0_
    2004-10-18 19:13:07,593 DEBUG [net.sf.hibernate.type.StringType] returning 'Foo' as column: street0_
    2004-10-18 19:13:07,593 DEBUG [net.sf.hibernate.type.StringType] returning 'Bar' as column: city0_
    2004-10-18 19:13:07,593 DEBUG [net.sf.hibernate.type.IntegerType] returning '1360' as column: post0_
    2004-10-18 19:13:07,593 DEBUG [net.sf.hibernate.type.StringType] returning 'qq' as column: country0_
    2004-10-18 19:13:07,593 DEBUG [net.sf.hibernate.type.StringType] returning 'ales' as column: username0_
    2004-10-18 19:13:07,593 DEBUG [net.sf.hibernate.type.StringType] returning 'ales' as column: password0_
    2004-10-18 19:13:07,593 DEBUG [net.sf.hibernate.type.IntegerType] returning '1' as column: status_key0_
    2004-10-18 19:13:07,593 DEBUG [net.sf.hibernate.type.IntegerType] returning '1' as column: creator_id0_
    2004-10-18 19:13:07,593 DEBUG [net.sf.hibernate.type.TimestampType] returning '13 avgust 2004 10:52:04' as column: creatio15_0_
    2004-10-18 19:13:07,593 DEBUG [net.sf.hibernate.type.IntegerType] returning '1' as column: def_module0_
    2004-10-18 19:13:07,593 DEBUG [net.sf.hibernate.impl.SessionImpl] Version: 1
    2004-10-18 19:13:07,593 DEBUG [net.sf.hibernate.loader.Loader] done processing result set (1 rows)
    2004-10-18 19:13:07,593 DEBUG [net.sf.hibernate.impl.BatcherImpl] done closing: 0 open PreparedStatements, 0 open ResultSets
    2004-10-18 19:13:07,593 DEBUG [net.sf.hibernate.impl.BatcherImpl] closing statement
    2004-10-18 19:13:07,593 DEBUG [net.sf.hibernate.loader.Loader] total objects hydrated: 1
    2004-10-18 19:13:07,593 DEBUG [net.sf.hibernate.impl.SessionImpl] resolving associations for [com.generalynx.egida.basic.common.data.User#1]
    2004-10-18 19:13:07,593 DEBUG [net.sf.hibernate.impl.SessionImpl] creating collection wrapper:[com.generalynx.egida.basic.common.data.User.roles# 1]
    2004-10-18 19:13:07,593 DEBUG [net.sf.hibernate.impl.SessionImpl] creating collection wrapper:[com.generalynx.egida.basic.common.data.User.module s#1]
    2004-10-18 19:13:07,593 DEBUG [net.sf.hibernate.impl.SessionImpl] done materializing entity [com.generalynx.egida.basic.common.data.User#1]
    2004-10-18 19:13:07,593 DEBUG [net.sf.hibernate.impl.SessionImpl] initializing non-lazy collections
    2004-10-18 19:13:07,593 DEBUG [net.sf.hibernate.impl.SessionImpl] initializing collection [com.generalynx.egida.basic.common.data.User.module s#1]
    2004-10-18 19:13:07,593 DEBUG [net.sf.hibernate.impl.SessionImpl] checking second-level cache
    2004-10-18 19:13:07,593 DEBUG [net.sf.hibernate.cache.ReadWriteCache] Cache lookup: 1
    2004-10-18 19:13:07,593 DEBUG [net.sf.ehcache.hibernate.Plugin] key: 1
    2004-10-18 19:13:07,593 DEBUG [net.sf.ehcache.store.MemoryStore] com.generalynx.egida.basic.common.data.User.module sCache: MemoryStore hit for 1
    2004-10-18 19:13:07,593 DEBUG [net.sf.ehcache.Cache] 1 now: 1098119587593
    2004-10-18 19:13:07,593 DEBUG [net.sf.ehcache.Cache] 1 Creation Time: 1098119497437 Next To Last Access Time: 1098119547437
    2004-10-18 19:13:07,593 DEBUG [net.sf.ehcache.Cache] 1 mostRecentTime: 1098119547437
    2004-10-18 19:13:07,593 DEBUG [net.sf.ehcache.Cache] 1 Age to Idle: 0 Age Idled: 40156
    2004-10-18 19:13:07,593 DEBUG [net.sf.ehcache.Cache] com.generalynx.egida.basic.common.data.User.module s: Is element with key 1 expired?: false
    ... reading data from cache
    2004-10-18 19:13:07,593 DEBUG [net.sf.hibernate.cache.ReadWriteCache] Cache hit: 1
    2004-10-18 19:13:07,593 DEBUG [net.sf.hibernate.impl.SessionImpl] loading [com.generalynx.common.web.module.Module#6]
    2004-10-18 19:13:07,593 DEBUG [net.sf.hibernate.impl.SessionImpl] attempting to resolve [com.generalynx.common.web.module.Module#6]
    2004-10-18 19:13:07,625 DEBUG [com.generalynx.egida.web.interceptor.ObjectVersion CheckerInterceptor] Reloading object 'com.generalynx.egida.basic.common.data.User@1cda8 1e' of type [com.generalynx.egida.basic.common.data.User] with version 1
    2004-10-18 19:13:07,625 DEBUG [org.springframework.transaction.support.Transactio nSynchronizationManager] Retrieved value [org.springframework.orm.hibernate.SessionHolder@36 bc0a] for key [net.sf.hibernate.impl.SessionFactoryImpl@13e3940] bound to thread [http-0.0.0.0-8080-Processor22]
    2004-10-18 19:13:07,625 DEBUG [com.generalynx.egida.web.interceptor.ObjectAttache rInterceptor] Reattaching object 'com.generalynx.egida.basic.common.data.User@1cda8 1e' of type [com.generalynx.egida.basic.common.data.User] to net.sf.hibernate.impl.SessionImpl@1612600
    2004-10-18 19:13:07,625 DEBUG [org.springframework.web.servlet.DispatcherServlet] Testing handler adapter [org.springframework.web.servlet.mvc.SimpleControll erHandlerAdapter@15be8d3]
    2004-10-18 19:13:07,625 DEBUG [com.generalynx.egida.web.form.UserModuleSelectForm] Displaying new form
    2004-10-18 19:13:07,703 DEBUG [org.springframework.beans.CachedIntrospectionResul ts] Getting BeanInfo for class [com.generalynx.egida.web.object.MemberSelector]
    2004-10-18 19:13:07,718 DEBUG [org.springframework.beans.CachedIntrospectionResul ts] Caching PropertyDescriptors for class [com.generalynx.egida.web.object.MemberSelector]
    2004-10-18 19:13:07,718 DEBUG [org.springframework.beans.CachedIntrospectionResul ts] Found property 'action' of type [class java.lang.String]; editor=[null]
    2004-10-18 19:13:07,718 DEBUG [org.springframework.beans.CachedIntrospectionResul ts] Found property 'class' of type [class java.lang.Class]; editor=[null]
    2004-10-18 19:13:07,718 DEBUG [org.springframework.beans.CachedIntrospectionResul ts] Found property 'id' of type [int]; editor=[null]
    2004-10-18 19:13:07,718 DEBUG [org.springframework.beans.CachedIntrospectionResul ts] Found property 'left' of type [class [I]; editor=[null]
    2004-10-18 19:13:07,718 DEBUG [org.springframework.beans.CachedIntrospectionResul ts] Found property 'right' of type [class [I]; editor=[null]
    2004-10-18 19:13:07,718 DEBUG [org.springframework.beans.CachedIntrospectionResul ts] Class [com.generalynx.egida.web.object.MemberSelector] is cache-safe
    2004-10-18 19:13:07,718 DEBUG [org.springframework.ejb.access.LocalStatelessSessi onProxyFactoryBean] Trying to create reference to local EJB
    2004-10-18 19:13:07,718 DEBUG [org.springframework.ejb.access.LocalStatelessSessi onProxyFactoryBean] Obtained reference to local EJB: BasicSessionEJB:Stateless
    2004-10-18 19:13:07,718 DEBUG [org.springframework.transaction.support.Transactio nSynchronizationManager] Retrieved value [org.springframework.orm.hibernate.SessionHolder@36 bc0a] for key [net.sf.hibernate.impl.SessionFactoryImpl@13e3940] bound to thread [http-0.0.0.0-8080-Processor22]
    2004-10-18 19:13:07,718 DEBUG [org.springframework.orm.hibernate.SessionFactoryUt ils] Opening Hibernate session
    2004-10-18 19:13:07,718 DEBUG [net.sf.hibernate.impl.SessionImpl] opened session
    2004-10-18 19:13:07,718 DEBUG [org.springframework.orm.hibernate.SessionFactoryUt ils] Registering JTA transaction synchronization for new Hibernate session
    2004-10-18 19:13:07,718 DEBUG [net.sf.hibernate.impl.SessionImpl] loading [com.generalynx.egida.basic.common.data.User#1]
    2004-10-18 19:13:07,718 DEBUG [org.springframework.transaction.support.Transactio nSynchronizationManager] Retrieved value [org.springframework.orm.hibernate.SessionHolder@36 bc0a] for key [net.sf.hibernate.impl.SessionFactoryImpl@13e3940] bound to thread [http-0.0.0.0-8080-Processor22]
    2004-10-18 19:13:07,718 DEBUG [org.springframework.orm.hibernate.SessionFactoryUt ils] Flushing Hibernate session on transaction synchronization
    2004-10-18 19:13:07,718 DEBUG [net.sf.hibernate.impl.SessionImpl] flushing session
    2004-10-18 19:13:07,718 DEBUG [net.sf.hibernate.impl.SessionImpl] Flushing entities and processing referenced collections
    2004-10-18 19:13:07,718 DEBUG [net.sf.hibernate.impl.SessionImpl] Processing unreferenced collections
    2004-10-18 19:13:07,718 DEBUG [net.sf.hibernate.impl.SessionImpl] Scheduling collection removes/(re)creates/updates
    2004-10-18 19:13:07,718 DEBUG [net.sf.hibernate.impl.SessionImpl] Flushed: 0 insertions, 0 updates, 0 deletions to 0 objects
    2004-10-18 19:13:07,718 DEBUG [net.sf.hibernate.impl.SessionImpl] Flushed: 0 (re)creations, 0 updates, 0 removals to 0 collections
    2004-10-18 19:13:07,718 DEBUG [net.sf.hibernate.impl.SessionImpl] executing flush
    2004-10-18 19:13:07,718 DEBUG [net.sf.hibernate.impl.SessionImpl] post flush
    2004-10-18 19:13:07,718 DEBUG [org.springframework.orm.hibernate.SessionFactoryUt ils] Closing Hibernate session
    2004-10-18 19:13:07,718 DEBUG [net.sf.hibernate.impl.SessionImpl] closing session
    2004-10-18 19:13:07,796 ERROR [net.sf.hibernate.proxy.LazyInitializer] Exception initializing proxy
    net.sf.hibernate.HibernateException: Could not initialize proxy - the owning Session was closed
    at net.sf.hibernate.proxy.LazyInitializer.initialize( LazyInitializer.java:47)
    at net.sf.hibernate.proxy.LazyInitializer.initializeW rapExceptions(LazyInitializer.java:60)
    at net.sf.hibernate.proxy.LazyInitializer.getImplemen tation(LazyInitializer.java:164)
    at net.sf.hibernate.proxy.CGLIBLazyInitializer.interc ept(CGLIBLazyInitializer.java:108)
    at com.generalynx.egida.basic.common.data.User$$Enhan cerByCGLIB$$ce4cd7dc.getModules(<generated>)
    at com.generalynx.egida.web.form.UserModuleSelectForm .getMembers(UserModuleSelectForm.java:37)
    at com.generalynx.egida.web.form.UserModuleSelectForm .getMutableMembers(UserModuleSelectForm.java:41)
    at com.generalynx.egida.web.form.AbstractSingleSelect Form.showForm(AbstractSingleSelectForm.java:54)
    at org.springframework.web.servlet.mvc.AbstractFormCo ntroller.showNewForm(AbstractFormController.java:2 84)
    at org.springframework.web.servlet.mvc.AbstractFormCo ntroller.handleRequestInternal(AbstractFormControl ler.java:240)
    at org.springframework.web.servlet.mvc.AbstractContro ller.handleRequest(AbstractController.java:121)
    at org.springframework.web.servlet.mvc.SimpleControll erHandlerAdapter.handle(SimpleControllerHandlerAda pter.java:44)
    at org.springframework.web.servlet.DispatcherServlet. doService(DispatcherServlet.java:495)
    at org.springframework.web.servlet.FrameworkServlet.s ervice(FrameworkServlet.java:321)
    at javax.servlet.http.HttpServlet.service(HttpServlet .java:810)
    at org.apache.catalina.core.ApplicationFilterChain.in ternalDoFilter(ApplicationFilterChain.java:237)
    at org.apache.catalina.core.ApplicationFilterChain.do Filter(ApplicationFilterChain.java:157)
    at com.generalynx.common.filters.SessionFilter.doFilt er(SessionFilter.java:53)
    at org.apache.catalina.core.ApplicationFilterChain.in ternalDoFilter(ApplicationFilterChain.java:186)
    at org.apache.catalina.core.ApplicationFilterChain.do Filter(ApplicationFilterChain.java:157)
    at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doF ilter(ReplyHeaderFilter.java:75)
    at org.apache.catalina.core.ApplicationFilterChain.in ternalDoFilter(ApplicationFilterChain.java:186)
    at org.apache.catalina.core.ApplicationFilterChain.do Filter(ApplicationFilterChain.java:157)
    at org.apache.catalina.core.StandardWrapperValve.invo ke(StandardWrapperValve.java:214)
    at org.apache.catalina.core.StandardValveContext.invo keNext(StandardValveContext.java:104)
    at org.apache.catalina.core.StandardPipeline.invoke(S tandardPipeline.java:520)
    at org.apache.catalina.core.StandardContextValve.invo keInternal(StandardContextValve.java:198)
    at org.apache.catalina.core.StandardContextValve.invo ke(StandardContextValve.java:152)
    at org.apache.catalina.core.StandardValveContext.invo keNext(StandardValveContext.java:104)
    at org.jboss.web.tomcat.security.CustomPrincipalValve .invoke(CustomPrincipalValve.java:66)
    at org.apache.catalina.core.StandardValveContext.invo keNext(StandardValveContext.java:102)
    at org.jboss.web.tomcat.security.SecurityAssociationV alve.invoke(SecurityAssociationValve.java:158)
    at org.apache.catalina.core.StandardValveContext.invo keNext(StandardValveContext.java:102)
    at org.apache.catalina.core.StandardPipeline.invoke(S tandardPipeline.java:520)
    at org.apache.catalina.core.StandardHostValve.invoke( StandardHostValve.java:137)
    at org.apache.catalina.core.StandardValveContext.invo keNext(StandardValveContext.java:104)
    at org.apache.catalina.valves.ErrorReportValve.invoke (ErrorReportValve.java:118)
    at org.apache.catalina.core.StandardValveContext.invo keNext(StandardValveContext.java:102)
    at org.apache.catalina.core.StandardPipeline.invoke(S tandardPipeline.java:520)
    at org.apache.catalina.core.StandardEngineValve.invok e(StandardEngineValve.java:109)
    at org.apache.catalina.core.StandardValveContext.invo keNext(StandardValveContext.java:104)
    at org.apache.catalina.core.StandardPipeline.invoke(S tandardPipeline.java:520)
    at org.apache.catalina.core.ContainerBase.invoke(Cont ainerBase.java:929)
    at org.apache.coyote.tomcat5.CoyoteAdapter.service(Co yoteAdapter.java:160)
    at org.apache.coyote.http11.Http11Processor.process(H ttp11Processor.java:799)
    at org.apache.coyote.http11.Http11Protocol$Http11Conn ectionHandler.processConnection(Http11Protocol.jav a:705)
    at org.apache.tomcat.util.net.TcpWorkerThread.runIt(P oolTcpEndpoint.java:577)
    at org.apache.tomcat.util.threads.ThreadPool$ControlR unnable.run(ThreadPool.java:683)
    at java.lang.Thread.run(Thread.java:534)
    2004-10-18 19:13:07,812 DEBUG [org.springframework.web.servlet.DispatcherServlet] HandlerExceptionResolver returned ModelAndView [ModelAndView: reference to view with name 'exceptionView'; model is {exception=net.sf.hibernate.LazyInitializationExce ption: Exception initializing proxy: [com.generalynx.egida.basic.common.data.User#1]}] for exception
    2004-10-18 19:13:07,812 WARN [org.springframework.web.servlet.DispatcherServlet] Handler execution resulted in exception - forwarding to resolved error view
    net.sf.hibernate.LazyInitializationException: Exception initializing proxy: [com.generalynx.egida.basic.common.data.User#1]
    at net.sf.hibernate.proxy.LazyInitializer.initializeW rapExceptions(LazyInitializer.java:64)
    at net.sf.hibernate.proxy.LazyInitializer.getImplemen tation(LazyInitializer.java:164)
    at net.sf.hibernate.proxy.CGLIBLazyInitializer.interc ept(CGLIBLazyInitializer.java:108)
    at com.generalynx.egida.basic.common.data.User$$Enhan cerByCGLIB$$ce4cd7dc.getModules(<generated>)
    at com.generalynx.egida.web.form.UserModuleSelectForm .getMembers(UserModuleSelectForm.java:37)
    at com.generalynx.egida.web.form.UserModuleSelectForm .getMutableMembers(UserModuleSelectForm.java:41)
    at com.generalynx.egida.web.form.AbstractSingleSelect Form.showForm(AbstractSingleSelectForm.java:54)
    at org.springframework.web.servlet.mvc.AbstractFormCo ntroller.showNewForm(AbstractFormController.java:2 84)
    at org.springframework.web.servlet.mvc.AbstractFormCo ntroller.handleRequestInternal(AbstractFormControl ler.java:240)
    at org.springframework.web.servlet.mvc.AbstractContro ller.handleRequest(AbstractController.java:121)
    at org.springframework.web.servlet.mvc.SimpleControll erHandlerAdapter.handle(SimpleControllerHandlerAda pter.java:44)
    at org.springframework.web.servlet.DispatcherServlet. doService(DispatcherServlet.java:495)
    at org.springframework.web.servlet.FrameworkServlet.s ervice(FrameworkServlet.java:321)
    at javax.servlet.http.HttpServlet.service(HttpServlet .java:810)
    at org.apache.catalina.core.ApplicationFilterChain.in ternalDoFilter(ApplicationFilterChain.java:237)
    at org.apache.catalina.core.ApplicationFilterChain.do Filter(ApplicationFilterChain.java:157)
    at com.generalynx.common.filters.SessionFilter.doFilt er(SessionFilter.java:53)
    at org.apache.catalina.core.ApplicationFilterChain.in ternalDoFilter(ApplicationFilterChain.java:186)
    at org.apache.catalina.core.ApplicationFilterChain.do Filter(ApplicationFilterChain.java:157)
    at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doF ilter(ReplyHeaderFilter.java:75)
    at org.apache.catalina.core.ApplicationFilterChain.in ternalDoFilter(ApplicationFilterChain.java:186)
    at org.apache.catalina.core.ApplicationFilterChain.do Filter(ApplicationFilterChain.java:157)
    at org.apache.catalina.core.StandardWrapperValve.invo ke(StandardWrapperValve.java:214)
    at org.apache.catalina.core.StandardValveContext.invo keNext(StandardValveContext.java:104)
    at org.apache.catalina.core.StandardPipeline.invoke(S tandardPipeline.java:520)
    at org.apache.catalina.core.StandardContextValve.invo keInternal(StandardContextValve.java:198)
    at org.apache.catalina.core.StandardContextValve.invo ke(StandardContextValve.java:152)
    at org.apache.catalina.core.StandardValveContext.invo keNext(StandardValveContext.java:104)
    at org.jboss.web.tomcat.security.CustomPrincipalValve .invoke(CustomPrincipalValve.java:66)
    at org.apache.catalina.core.StandardValveContext.invo keNext(StandardValveContext.java:102)
    at org.jboss.web.tomcat.security.SecurityAssociationV alve.invoke(SecurityAssociationValve.java:158)
    at org.apache.catalina.core.StandardValveContext.invo keNext(StandardValveContext.java:102)
    at org.apache.catalina.core.StandardPipeline.invoke(S tandardPipeline.java:520)
    at org.apache.catalina.core.StandardHostValve.invoke( StandardHostValve.java:137)
    at org.apache.catalina.core.StandardValveContext.invo keNext(StandardValveContext.java:104)
    at org.apache.catalina.valves.ErrorReportValve.invoke (ErrorReportValve.java:118)
    at org.apache.catalina.core.StandardValveContext.invo keNext(StandardValveContext.java:102)
    at org.apache.catalina.core.StandardPipeline.invoke(S tandardPipeline.java:520)
    at org.apache.catalina.core.StandardEngineValve.invok e(StandardEngineValve.java:109)
    at org.apache.catalina.core.StandardValveContext.invo keNext(StandardValveContext.java:104)
    at org.apache.catalina.core.StandardPipeline.invoke(S tandardPipeline.java:520)
    at org.apache.catalina.core.ContainerBase.invoke(Cont ainerBase.java:929)
    at org.apache.coyote.tomcat5.CoyoteAdapter.service(Co yoteAdapter.java:160)
    at org.apache.coyote.http11.Http11Processor.process(H ttp11Processor.java:799)
    at org.apache.coyote.http11.Http11Protocol$Http11Conn ectionHandler.processConnection(Http11Protocol.jav a:705)
    at org.apache.tomcat.util.net.TcpWorkerThread.runIt(P oolTcpEndpoint.java:577)
    at org.apache.tomcat.util.threads.ThreadPool$ControlR unnable.run(ThreadPool.java:683)
    at java.lang.Thread.run(Thread.java:534)
    Caused by: net.sf.hibernate.HibernateException: Could not initialize proxy - the owning Session was closed
    at net.sf.hibernate.proxy.LazyInitializer.initialize( LazyInitializer.java:47)
    at net.sf.hibernate.proxy.LazyInitializer.initializeW rapExceptions(LazyInitializer.java:60)
    ... 47 more
    2004-10-18 19:13:07,828 DEBUG [org.springframework.web.servlet.DispatcherServlet] Will render view in DispatcherServlet with name 'egida'
    2004-10-18 19:13:07,828 DEBUG [org.springframework.beans.factory.support.DefaultL istableBeanFactory] Returning cached instance of singleton bean 'exceptionView'
    2004-10-18 19:13:07,828 INFO [org.springframework.web.servlet.view.ResourceBundl eViewResolver] Cached view 'exceptionView_sl'
    2004-10-18 19:13:07,828 DEBUG [org.springframework.web.servlet.view.tiles.TilesJs tlView] Rendering view with name 'exceptionView' with model {exception=net.sf.hibernate.LazyInitializationExce ption: Exception initializing proxy: [com.generalynx.egida.basic.common.data.User#1]} and static attributes {}
    2004-10-18 19:13:07,828 DEBUG [org.springframework.web.servlet.view.tiles.TilesJs tlView] Added model object 'exception' of type [net.sf.hibernate.LazyInitializationException] to request in InternalResourceView 'exceptionView'
    2004-10-18 19:13:07,937 DEBUG [org.springframework.web.servlet.view.tiles.TilesJs tlView] Forwarded to resource [exception.layout] in InternalResourceView 'exceptionView'
    2004-10-18 19:13:07,937 DEBUG [org.springframework.transaction.support.Transactio nSynchronizationManager] Removed value [org.springframework.orm.hibernate.SessionHolder@36 bc0a] for key [net.sf.hibernate.impl.SessionFactoryImpl@13e3940] from thread [http-0.0.0.0-8080-Processor22]
    2004-10-18 19:13:07,937 DEBUG [org.springframework.orm.hibernate.support.OpenSess ionInViewInterceptor] Closing single Hibernate session in OpenSessionInViewInterceptor
    2004-10-18 19:13:07,937 DEBUG [org.springframework.orm.hibernate.SessionFactoryUt ils] Closing Hibernate session
    2004-10-18 19:13:07,937 DEBUG [net.sf.hibernate.impl.SessionImpl] closing session
    2004-10-18 19:13:07,937 DEBUG [net.sf.hibernate.impl.SessionImpl] disconnecting session
    2004-10-18 19:13:07,937 DEBUG [net.sf.hibernate.impl.SessionImpl] transaction completion
    2004-10-18 19:13:07,937 DEBUG [org.springframework.web.servlet.DispatcherServlet] Successfully completed request
    2004-10-18 19:13:07,937 DEBUG [org.springframework.web.context.support.XmlWebAppl icationContext] Publishing event in context [XmlWebApplicationContext for namespace 'egida-servlet']: RequestHandledEvent: url=[/egida/userModuleSelect.htm]; time=[359ms]; client=[127.0.0.1]; method=[GET]; servlet=[egida]; session=[8465080A55954AF04DA6316FBD036828]; user=[null]; status=[OK]
    2004-10-18 19:13:07,937 DEBUG [org.springframework.web.context.support.XmlWebAppl icationContext] Publishing event in context [Root XmlWebApplicationContext]: RequestHandledEvent: url=[/egida/userModuleSelect.htm]; time=[359ms]; client=[127.0.0.1]; method=[GET]; servlet=[egida]; session=[8465080A55954AF04DA6316FBD036828]; user=[null]; status=[OK]
    2004-10-18 19:13:08,953 DEBUG [net.sf.hibernate.impl.SessionImpl] running Session.finalize()
    2004-10-18 19:13:08,953 DEBUG [net.sf.hibernate.impl.SessionImpl] running Session.finalize()
    2004-10-18 19:13:08,953 DEBUG [net.sf.hibernate.impl.SessionImpl] running Session.finalize()
    2004-10-18 19:17:36,859 DEBUG [org.jboss.resource.connectionmanager.IdleRemover] run: IdleRemover notifying pools, interval: 450000

  • #2
    Looking at the current implementation of getJtaSynchronizedSession in SessionFactoryUtils, unless I'm mistaken the code is wrong, as it can not handle the case of an existing thread-bound session (as would come from the OSIV filter). In this case, it will return null, not the existing session, and a new session will end up being created...

    filed as SPR-411:
    http://opensource.atlassian.com/proj...browse/SPR-411

    Comment


    • #3
      Ales,

      Juergen has now modifed Spring's relevant code, so the OpenSessionInView filter can work together with JTA-only trnasactions, as described in the bug report.

      I would recommend pulling out the CVS version, which includes this fix, to give it a go. Generally, using CVS head should be quite safe as it is bug fixes on top of 1.1.1.

      Note that SourceForge anonymous CVS is sometimes a few hours behind the developer CVS access. You will know that you have properly picked up this fix if your SessionFactoryUtils.java file is at revision 1.40 or later.

      Regards,

      Comment


      • #4
        Still closing connections?

        First really thanks to Juergen for updating SessionFactoryUtils with JTA session binding.

        But I really have no clue why this is still happening. And it only happens when I'm logging in on a user/pass form page. Otherwise it's working with no exception traces - but not as one should expect - see save problems below.

        As I mentioned, I'm using OSIVI and local SLSB with CMT.

        What makes login so different from other form/controller submissions?

        Method 'findUser' on SLSB has 'Supports' transaction attribute.

        How do this transactions cope with cache? Since I also noticed now that it doesn't save when I'm changing user's modules (each User object has cached Module Set)
        Code:
            <class
                name="com.generalynx.egida.basic.common.data.User"
                table="euser"
                proxy="com.generalynx.egida.basic.common.data.User"
                dynamic-update="false"
                dynamic-insert="false"
            >
        	...
                <set
                    name="modules"
                    table="moduleuser"
                    lazy="false"
                    inverse="true"
                    cascade="none"
                    sort="unsorted"
                >
                    <cache 
                        usage="read-write" 
                     />
                      <key
                          column="euser_id"
                      >
                      </key>
                      <many-to-many
                          class="com.generalynx.common.web.module.Module"
                          column="modul_id"
                          outer-join="auto"
                       />
        
                </set>        
                ...        
            </class>
        I'm using ehcache.

        Any help appreciated,
        regards, Ales

        ------------ login exception trace ---------------

        Same old 'Closing a connection for you. Please close them yourself: ...' exception :-(.

        16:01:26,609 INFO [CachedConnectionManager] Closing a connection for you. Please close them yourself: org.jboss.resource.adapter.jdbc.WrappedConnection@ 167e8f2
        java.lang.Exception: STACKTRACE
        at org.jboss.resource.connectionmanager.CachedConnect ionManager.registerConnection(CachedConnectionMana ger.java:319)
        at org.jboss.resource.connectionmanager.BaseConnectio nManager2.allocateConnection(BaseConnectionManager 2.java:525)
        at org.jboss.resource.connectionmanager.BaseConnectio nManager2$ConnectionManagerProxy.allocateConnectio n(BaseConnectionManager2.java:887)
        at org.jboss.resource.adapter.jdbc.WrapperDataSource. getConnection(WrapperDataSource.java:102)
        at net.sf.hibernate.connection.DatasourceConnectionPr ovider.getConnection(DatasourceConnectionProvider. java:59)
        at net.sf.hibernate.impl.BatcherImpl.openConnection(B atcherImpl.java:278)
        at net.sf.hibernate.impl.SessionImpl.connect(SessionI mpl.java:3302)
        at net.sf.hibernate.impl.SessionImpl.connection(Sessi onImpl.java:3282)
        at net.sf.hibernate.impl.BatcherImpl.prepareQueryStat ement(BatcherImpl.java:65)
        at net.sf.hibernate.loader.Loader.prepareQueryStateme nt(Loader.java:704)
        at net.sf.hibernate.loader.Loader.doQuery(Loader.java :185)
        at net.sf.hibernate.loader.Loader.doQueryAndInitializ eNonLazyCollections(Loader.java:133)
        at net.sf.hibernate.loader.Loader.doList(Loader.java: 958)
        at net.sf.hibernate.loader.Loader.list(Loader.java:94 9)
        at net.sf.hibernate.hql.QueryTranslator.list(QueryTra nslator.java:846)
        at net.sf.hibernate.impl.SessionImpl.find(SessionImpl .java:1543)
        at net.sf.hibernate.impl.QueryImpl.list(QueryImpl.jav a:39)
        at org.springframework.orm.hibernate.HibernateTemplat e$26.doInHibernate(HibernateTemplate.java:482)
        at org.springframework.orm.hibernate.HibernateTemplat e.execute(HibernateTemplate.java:200)
        at org.springframework.orm.hibernate.HibernateTemplat e.executeFind(HibernateTemplate.java:220)
        at org.springframework.orm.hibernate.HibernateTemplat e.find(HibernateTemplate.java:476)
        at com.generalynx.egida.basic.support.BasicDAOImpl.fi ndUser(BasicDAOImpl.java:107)
        at com.generalynx.egida.basic.ejb.BasicSessionBean.fi ndUser(BasicSessionBean.java:97)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:324)
        at org.jboss.ejb.StatelessSessionContainer$ContainerI nterceptor.invoke(StatelessSessionContainer.java:6 83)
        at org.jboss.resource.connectionmanager.CachedConnect ionInterceptor.invoke(CachedConnectionInterceptor. java:186)
        at org.jboss.ejb.plugins.StatelessSessionInstanceInte rceptor.invoke(StatelessSessionInstanceInterceptor .java:72)
        at org.jboss.ejb.plugins.AbstractTxInterceptor.invoke Next(AbstractTxInterceptor.java:84)
        at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTran sactions(TxInterceptorCMT.java:341)
        at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxIn terceptorCMT.java:148)
        at org.jboss.ejb.plugins.SecurityInterceptor.invoke(S ecurityInterceptor.java:111)
        at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInt erceptor.java:191)
        at org.jboss.ejb.plugins.ProxyFactoryFinderIntercepto r.invoke(ProxyFactoryFinderInterceptor.java:122)
        at org.jboss.ejb.StatelessSessionContainer.internalIn voke(StatelessSessionContainer.java:331)
        at org.jboss.ejb.Container.invoke(Container.java:709)
        at org.jboss.ejb.plugins.local.BaseLocalProxyFactory. invoke(BaseLocalProxyFactory.java:419)
        at org.jboss.ejb.plugins.local.StatelessSessionProxy. invoke(StatelessSessionProxy.java:83)
        at $Proxy47.findUser(Unknown Source)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:324)
        at org.springframework.ejb.access.LocalSlsbInvokerInt erceptor.invoke(LocalSlsbInvokerInterceptor.java:6 0)
        at org.springframework.aop.framework.ReflectiveMethod Invocation.proceed(ReflectiveMethodInvocation.java :143)
        at org.springframework.aop.framework.JdkDynamicAopPro xy.invoke(JdkDynamicAopProxy.java:174)
        at $Proxy48.findUser(Unknown Source)
        at com.generalynx.egida.web.controller.EgidaControlle r.logHandler(EgidaController.java:49)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:324)
        at org.springframework.web.servlet.mvc.multiaction.Mu ltiActionController.invokeNamedMethod(MultiActionC ontroller.java:352)
        at org.springframework.web.servlet.mvc.multiaction.Mu ltiActionController.handleRequestInternal(MultiAct ionController.java:305)
        at org.springframework.web.servlet.mvc.AbstractContro ller.handleRequest(AbstractController.java:128)
        at org.springframework.web.servlet.mvc.SimpleControll erHandlerAdapter.handle(SimpleControllerHandlerAda pter.java:44)
        at org.springframework.web.servlet.DispatcherServlet. doService(DispatcherServlet.java:532)
        at org.springframework.web.servlet.FrameworkServlet.s erviceWrapper(FrameworkServlet.java:384)
        at org.springframework.web.servlet.FrameworkServlet.d oPost(FrameworkServlet.java:326)
        at javax.servlet.http.HttpServlet.service(HttpServlet .java:717)
        at javax.servlet.http.HttpServlet.service(HttpServlet .java:810)
        at org.apache.catalina.core.ApplicationFilterChain.in ternalDoFilter(ApplicationFilterChain.java:237)
        at org.apache.catalina.core.ApplicationFilterChain.do Filter(ApplicationFilterChain.java:157)
        at com.generalynx.common.filters.SessionFilter.doFilt er(SessionFilter.java:53)
        at org.apache.catalina.core.ApplicationFilterChain.in ternalDoFilter(ApplicationFilterChain.java:186)
        at org.apache.catalina.core.ApplicationFilterChain.do Filter(ApplicationFilterChain.java:157)
        at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doF ilter(ReplyHeaderFilter.java:75)
        at org.apache.catalina.core.ApplicationFilterChain.in ternalDoFilter(ApplicationFilterChain.java:186)
        at org.apache.catalina.core.ApplicationFilterChain.do Filter(ApplicationFilterChain.java:157)
        at org.apache.catalina.core.StandardWrapperValve.invo ke(StandardWrapperValve.java:214)
        at org.apache.catalina.core.StandardValveContext.invo keNext(StandardValveContext.java:104)
        at org.apache.catalina.core.StandardPipeline.invoke(S tandardPipeline.java:520)
        at org.apache.catalina.core.StandardContextValve.invo keInternal(StandardContextValve.java:198)
        at org.apache.catalina.core.StandardContextValve.invo ke(StandardContextValve.java:152)
        at org.apache.catalina.core.StandardValveContext.invo keNext(StandardValveContext.java:104)
        at org.jboss.web.tomcat.security.CustomPrincipalValve .invoke(CustomPrincipalValve.java:66)
        at org.apache.catalina.core.StandardValveContext.invo keNext(StandardValveContext.java:102)
        at org.jboss.web.tomcat.security.SecurityAssociationV alve.invoke(SecurityAssociationValve.java:158)
        at org.apache.catalina.core.StandardValveContext.invo keNext(StandardValveContext.java:102)
        at org.apache.catalina.core.StandardPipeline.invoke(S tandardPipeline.java:520)
        at org.apache.catalina.core.StandardHostValve.invoke( StandardHostValve.java:137)
        at org.apache.catalina.core.StandardValveContext.invo keNext(StandardValveContext.java:104)
        at org.apache.catalina.valves.ErrorReportValve.invoke (ErrorReportValve.java:118)
        at org.apache.catalina.core.StandardValveContext.invo keNext(StandardValveContext.java:102)
        at org.apache.catalina.core.StandardPipeline.invoke(S tandardPipeline.java:520)
        at org.apache.catalina.core.StandardEngineValve.invok e(StandardEngineValve.java:109)
        at org.apache.catalina.core.StandardValveContext.invo keNext(StandardValveContext.java:104)
        at org.apache.catalina.core.StandardPipeline.invoke(S tandardPipeline.java:520)
        at org.apache.catalina.core.ContainerBase.invoke(Cont ainerBase.java:929)
        at org.apache.coyote.tomcat5.CoyoteAdapter.service(Co yoteAdapter.java:160)
        at org.apache.coyote.http11.Http11Processor.process(H ttp11Processor.java:799)
        at org.apache.coyote.http11.Http11Protocol$Http11Conn ectionHandler.processConnection(Http11Protocol.jav a:705)
        at org.apache.tomcat.util.net.TcpWorkerThread.runIt(P oolTcpEndpoint.java:577)
        at org.apache.tomcat.util.threads.ThreadPool$ControlR unnable.run(ThreadPool.java:683)
        at java.lang.Thread.run(Thread.java:534)

        Comment


        • #5
          As far as I have been able to tell, the "closing connection for you" message from JBoss is spurious, and happens because the JBoss transaction manager is confused. It is annoying, but not an indication that Spring actually did anything wrong or out of order.

          I am confused though as to whether this fix resolved the lazy loading issue for you? Are you still getting two sessions, or only one, according to the log?

          As for your save/update not saving changes to the module, I don't have anywhere near enough information to know what you're actually doing (in what tier you're getting the object, modiying the objects, are you transactional, etc.), and this is getting into Hibernate specifics. If you can give me a more directed question (Spring related) I can answer that, or if you think there's a bug, etc., but for the Hibernate stuff you need to think through what is actually going on with yourr objects, the Hibernate Session, and hibernate itself...

          Comment


          • #6
            I am confused though as to whether this fix resolved the lazy loading issue for you? Are you still getting two sessions, or only one, according to the log?
            Now it looks like its all happening in one session - as one would expect from looking at the source code.

            For that other Hibernate stuff, sorry to bother you - will definitely look at Hibernate stuff, since it's obviousey not Spring issue. :wink:

            As far as I have been able to tell, the "closing connection for you" message from JBoss is spurious, and happens because the JBoss transaction manager is confused. It is annoying, but not an indication that Spring actually did anything wrong or out of order.
            I've been suggested from Hibernate wiki page to use this:
            In your transaction-service.xml in the deploy directory,
            make sure you have
            <!-- Enable connection close debug monitoring -->
            <attribute name="Debug">false</attribute>

            If debug is set to true, JBoss will close your connection before you are
            done with them. Very annoying.
            But I feel all this does is doesn't log this 'exception'? :?
            Since I now don't get an exception trace.

            Rgds, Ales

            Comment


            • #7
              Well, the question is whether the message is spurious or not. I spent hours in a debugger tracing through Spring code and some JBoss code, trying to see if there was any basis for the message, and as far as I was able to tell, JBoss is simply getting confused... I also had an app in production which generated that message, with no ill effects...

              Comment


              • #8
                it worked

                just wanted to thankyou [alesj and Colin Sampaleanu] for having a discussion on this issue. cause it helped me get thru the same problem.

                Comment

                Working...
                X