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

Atlassian JIRA | Gurleen Anand [Atlassian] | 10 years ago
tip
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.
  1. 0

    Enabling caching for hibernate repository by adding the *cache="true"* directive in the atlassian-user.xml file, such as this: {noformat} <hibernate name="Hibernate Repository" key="hibernateRepository" description="Hibernate Repository" cache="true" /> {noformat} leads to the following exception: {noformat} Cause: 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) Stack Trace: [hide] 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.contains(Set.java:122) at com.atlassian.user.impl.hibernate.HibernateGroupManager.hasExternalMembership(HibernateGroupManager.java:461) at com.atlassian.user.impl.hibernate.HibernateGroupManager.hasMembership(HibernateGroupManager.java:437) at com.atlassian.user.impl.cache.CachingGroupManager.hasMembership(CachingGroupManager.java:149) at com.atlassian.user.impl.delegation.DelegatingGroupManagerTemplate.hasMembership(DelegatingGroupManagerTemplate.java:189) {noformat}

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

    Enabling caching for hibernate repository by adding the *cache="true"* directive in the atlassian-user.xml file, such as this: {noformat} <hibernate name="Hibernate Repository" key="hibernateRepository" description="Hibernate Repository" cache="true" /> {noformat} leads to the following exception: {noformat} Cause: 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) Stack Trace: [hide] 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.contains(Set.java:122) at com.atlassian.user.impl.hibernate.HibernateGroupManager.hasExternalMembership(HibernateGroupManager.java:461) at com.atlassian.user.impl.hibernate.HibernateGroupManager.hasMembership(HibernateGroupManager.java:437) at com.atlassian.user.impl.cache.CachingGroupManager.hasMembership(CachingGroupManager.java:149) at com.atlassian.user.impl.delegation.DelegatingGroupManagerTemplate.hasMembership(DelegatingGroupManagerTemplate.java:189) {noformat}

    Atlassian JIRA | 10 years ago | Gurleen Anand [Atlassian]
    net.sf.hibernate.LazyInitializationException: Failed to lazily initialize a collection - no session or session was closed

    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.contains
      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.contains(Set.java:122)
      3 frames
    3. com.atlassian.user
      DelegatingGroupManagerTemplate.hasMembership
      1. com.atlassian.user.impl.hibernate.HibernateGroupManager.hasExternalMembership(HibernateGroupManager.java:461)
      2. com.atlassian.user.impl.hibernate.HibernateGroupManager.hasMembership(HibernateGroupManager.java:437)
      3. com.atlassian.user.impl.cache.CachingGroupManager.hasMembership(CachingGroupManager.java:149)
      4. com.atlassian.user.impl.delegation.DelegatingGroupManagerTemplate.hasMembership(DelegatingGroupManagerTemplate.java:189)
      4 frames