net.sf.hibernate.LazyInitializationException: Failed to lazily initialize a collection - no session or session was closed

Atlassian JIRA | Tom Davies [Atlassian] | 8 years ago
  1. 0

    The sessioninview filter doesn't cover rpc URLs (I think because this meant that RPC actions didn't show up in the DB until the response what completely written) This means that lazily loaded data returned by the HibernateTrustedApplicationDao causes problems when the TrustedApplicationsFilter tries to use it: 2008-08-19 14:39:04,952 ERROR [http-57362-Processor23] [[Catalina].[localhost].[/confluence].[xmlrpc]] invoke Servlet.service() for servlet xmlrpc threw exception net.sf.hibernate.LazyInitializationException: Failed to lazily initialize a collection - no session or session was closed at net.sf.hibernate.collection.PersistentCollection.initialize(PersistentCollection.java:209) at net.sf.hibernate.collection.PersistentCollection.read(PersistentCollection.java:71) at net.sf.hibernate.collection.Set.size(Set.java:106) at org.apache.commons.collections.CollectionUtils.select(CollectionUtils.java:496) at com.atlassian.confluence.security.trust.ConfluenceTrustedApplication.getRestrictionsByType(ConfluenceTrustedApplication.java:87) at com.atlassian.confluence.security.trust.ConfluenceTrustedApplication.getUrlRestrictions(ConfluenceTrustedApplication.java:77) at com.atlassian.confluence.security.trust.seraph.SeraphTrustedApplicationIntegration.getUrlMatcher(SeraphTrustedApplicationIntegration.java:44) at com.atlassian.confluence.security.trust.seraph.SeraphTrustedApplicationIntegration.getTrustedApplication(SeraphTrustedApplicationIntegration.java:32) at com.atlassian.seraph.filter.TrustedApplicationsFilter$AuthenticatorImpl.authenticate(TrustedApplicationsFilter.java:441) at com.atlassian.seraph.filter.TrustedApplicationsFilter.authenticate(TrustedApplicationsFilter.java:133) at com.atlassian.seraph.filter.TrustedApplicationsFilter.doFilter(TrustedApplicationsFilter.java:110) at com.atlassian.confluence.util.AbstractBootstrapHotSwappingFilter.doFilter(AbstractBootstrapHotSwappingFilter.java:28) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188) at com.atlassian.seraph.filter.BaseLoginFilter.doFilter(BaseLoginFilter.java:125) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188) at com.atlassian.confluence.util.ClusterHeaderFilter.doFilter(ClusterHeaderFilter.java:35) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188) at com.atlassian.gzipfilter.GzipFilter.doFilterInternal(GzipFilter.java:94) at com.atlassian.gzipfilter.GzipFilter.doFilter(GzipFilter.java:64) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:544) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:151) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:874) at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665) at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528) at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689) at java.lang.Thread.run(Thread.java:613)

    Atlassian JIRA | 8 years ago | Tom Davies [Atlassian]
    net.sf.hibernate.LazyInitializationException: Failed to lazily initialize a collection - no session or session was closed
  2. 0

    The sessioninview filter doesn't cover rpc URLs (I think because this meant that RPC actions didn't show up in the DB until the response what completely written) This means that lazily loaded data returned by the HibernateTrustedApplicationDao causes problems when the TrustedApplicationsFilter tries to use it: 2008-08-19 14:39:04,952 ERROR [http-57362-Processor23] [[Catalina].[localhost].[/confluence].[xmlrpc]] invoke Servlet.service() for servlet xmlrpc threw exception net.sf.hibernate.LazyInitializationException: Failed to lazily initialize a collection - no session or session was closed at net.sf.hibernate.collection.PersistentCollection.initialize(PersistentCollection.java:209) at net.sf.hibernate.collection.PersistentCollection.read(PersistentCollection.java:71) at net.sf.hibernate.collection.Set.size(Set.java:106) at org.apache.commons.collections.CollectionUtils.select(CollectionUtils.java:496) at com.atlassian.confluence.security.trust.ConfluenceTrustedApplication.getRestrictionsByType(ConfluenceTrustedApplication.java:87) at com.atlassian.confluence.security.trust.ConfluenceTrustedApplication.getUrlRestrictions(ConfluenceTrustedApplication.java:77) at com.atlassian.confluence.security.trust.seraph.SeraphTrustedApplicationIntegration.getUrlMatcher(SeraphTrustedApplicationIntegration.java:44) at com.atlassian.confluence.security.trust.seraph.SeraphTrustedApplicationIntegration.getTrustedApplication(SeraphTrustedApplicationIntegration.java:32) at com.atlassian.seraph.filter.TrustedApplicationsFilter$AuthenticatorImpl.authenticate(TrustedApplicationsFilter.java:441) at com.atlassian.seraph.filter.TrustedApplicationsFilter.authenticate(TrustedApplicationsFilter.java:133) at com.atlassian.seraph.filter.TrustedApplicationsFilter.doFilter(TrustedApplicationsFilter.java:110) at com.atlassian.confluence.util.AbstractBootstrapHotSwappingFilter.doFilter(AbstractBootstrapHotSwappingFilter.java:28) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188) at com.atlassian.seraph.filter.BaseLoginFilter.doFilter(BaseLoginFilter.java:125) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188) at com.atlassian.confluence.util.ClusterHeaderFilter.doFilter(ClusterHeaderFilter.java:35) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188) at com.atlassian.gzipfilter.GzipFilter.doFilterInternal(GzipFilter.java:94) at com.atlassian.gzipfilter.GzipFilter.doFilter(GzipFilter.java:64) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:544) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:151) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:874) at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665) at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528) at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689) at java.lang.Thread.run(Thread.java:613)

    Atlassian JIRA | 8 years ago | Tom Davies [Atlassian]
    net.sf.hibernate.LazyInitializationException: Failed to lazily initialize a collection - no session or session was closed
  3. 0

    OpenSessionInViewInterceptor Spring MVC prob

    springframework | 1 decade ago | chrisnam1208
    net.sf.hibernate.LazyInitializationException: Failed to lazily initialize a collection
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Deleting a user generates a net.sf.hibernate.LazyInitializationException. After this you cannot enter the 'browse' user screen. The user is deleted succesfully, but you need to restart the app server to get things behaving again. We're using LDAP against ActiveDirectory for some users; this might be relevant. We also had this problem in 1.1.2 but didn't report as I thought it might have gone away in 1.3. Here's the relevant bit of the stack trace: net.sf.hibernate.LazyInitializationException: Failed to lazily initialize a collection at net.sf.hibernate.collection.PersistentCollection.initialize(PersistentCollection.java:201) at net.sf.hibernate.collection.PersistentCollection.read(PersistentCollection.java:71) at net.sf.hibernate.collection.Set.size(Set.java:106) at com.opensymphony.user.provider.hibernate.entity.HibernateGroup.getUserNameList(HibernateGroup.java:33) at com.opensymphony.user.provider.hibernate.HibernateAccessProvider.listUsersInGroup(HibernateAccessProvider.java:151) at bucket.user.providers.ChainedAccessProvider.listUsersInGroup(ChainedAccessProvider.java:45) at com.opensymphony.user.Group.getUsers(Group.java:65) at com.atlassian.confluence.user.DefaultUserAccessor.getActiveUsers(DefaultUserAccessor.java:168) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.springframework.aop.framework.AopProxyUtils.invokeJoinpointUsingReflection(AopProxyUtils.java:61) at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:149) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:116) at com.atlassian.confluence.util.profiling.SpringProfilingInterceptor.invoke(SpringProfilingInterceptor.java:16) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:138) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:56) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:138) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:152) at $Proxy8.getActiveUsers(Unknown Source) at com.atlassian.confluence.user.actions.BrowseUsersAction.getUsers(BrowseUsersAction.java:65) at com.atlassian.confluence.user.actions.BrowseUsersAction.execute(BrowseUsersAction.java:46) at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:168)

    Atlassian JIRA | 1 decade ago | Simon Jones
    net.sf.hibernate.LazyInitializationException: Failed to lazily initialize a collection
  6. 0

    getting a "Failed to lazily" error...

    xplanner | 9 years ago | krherrmann
    net.sf.hibernate.LazyInitializationException: Failed to lazily initialize a collection

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. net.sf.hibernate.LazyInitializationException

      Failed to lazily initialize a collection - no session or session was closed

      at net.sf.hibernate.collection.PersistentCollection.initialize()
    2. net.sf.hibernate
      Set.size
      1. net.sf.hibernate.collection.PersistentCollection.initialize(PersistentCollection.java:209)
      2. net.sf.hibernate.collection.PersistentCollection.read(PersistentCollection.java:71)
      3. net.sf.hibernate.collection.Set.size(Set.java:106)
      3 frames
    3. Commons Collections
      CollectionUtils.select
      1. org.apache.commons.collections.CollectionUtils.select(CollectionUtils.java:496)
      1 frame
    4. com.atlassian.confluence
      SeraphTrustedApplicationIntegration.getTrustedApplication
      1. com.atlassian.confluence.security.trust.ConfluenceTrustedApplication.getRestrictionsByType(ConfluenceTrustedApplication.java:87)
      2. com.atlassian.confluence.security.trust.ConfluenceTrustedApplication.getUrlRestrictions(ConfluenceTrustedApplication.java:77)
      3. com.atlassian.confluence.security.trust.seraph.SeraphTrustedApplicationIntegration.getUrlMatcher(SeraphTrustedApplicationIntegration.java:44)
      4. com.atlassian.confluence.security.trust.seraph.SeraphTrustedApplicationIntegration.getTrustedApplication(SeraphTrustedApplicationIntegration.java:32)
      4 frames
    5. com.atlassian.seraph
      TrustedApplicationsFilter.doFilter
      1. com.atlassian.seraph.filter.TrustedApplicationsFilter$AuthenticatorImpl.authenticate(TrustedApplicationsFilter.java:441)
      2. com.atlassian.seraph.filter.TrustedApplicationsFilter.authenticate(TrustedApplicationsFilter.java:133)
      3. com.atlassian.seraph.filter.TrustedApplicationsFilter.doFilter(TrustedApplicationsFilter.java:110)
      3 frames
    6. com.atlassian.confluence
      AbstractBootstrapHotSwappingFilter.doFilter
      1. com.atlassian.confluence.util.AbstractBootstrapHotSwappingFilter.doFilter(AbstractBootstrapHotSwappingFilter.java:28)
      1 frame
    7. Glassfish Core
      ApplicationFilterChain.doFilter
      1. org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
      2. org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
      2 frames
    8. com.atlassian.seraph
      BaseLoginFilter.doFilter
      1. com.atlassian.seraph.filter.BaseLoginFilter.doFilter(BaseLoginFilter.java:125)
      1 frame
    9. Glassfish Core
      ApplicationFilterChain.doFilter
      1. org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
      2. org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
      2 frames
    10. com.atlassian.confluence
      ClusterHeaderFilter.doFilter
      1. com.atlassian.confluence.util.ClusterHeaderFilter.doFilter(ClusterHeaderFilter.java:35)
      1 frame
    11. Glassfish Core
      ApplicationFilterChain.doFilter
      1. org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
      2. org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
      2 frames
    12. com.atlassian.gzipfilter
      GzipFilter.doFilter
      1. com.atlassian.gzipfilter.GzipFilter.doFilterInternal(GzipFilter.java:94)
      2. com.atlassian.gzipfilter.GzipFilter.doFilter(GzipFilter.java:64)
      2 frames
    13. Glassfish Core
      CoyoteAdapter.service
      1. org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
      2. org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
      3. org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
      4. org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174)
      5. org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
      6. org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
      7. org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:544)
      8. org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
      9. org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:151)
      9 frames
    14. Grizzly HTTP
      LeaderFollowerWorkerThread.runIt
      1. org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:874)
      2. org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
      3. org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
      4. org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
      4 frames
    15. Tomcat Util
      ThreadPool$ControlRunnable.run
      1. org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689)
      1 frame
    16. Java RT
      Thread.run
      1. java.lang.Thread.run(Thread.java:613)
      1 frame