org.hibernate.HibernateException: Illegal attempt to associate a collection with two open sessions

Atlassian JIRA | Bryan Turner | 2 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

    [BSERV-5504] Crowd synchronization can fail processing groups - Atlassian JIRA

    atlassian.com | 1 year ago
    org.hibernate.HibernateException: Illegal attempt to associate a collection with two open sessions
  2. 0

    When group deletions are synchronized, it's possible for synchronization to fail with an error message like this: {noformat} 2014-11-18 06:41:59,215 ERROR [clusterScheduler_Worker-5] c.a.c.u.p.h.b.AbstractBatchProcessor Could not process class com.atlassian.crowd.model.group.InternalGroup: com.atlassian.crowd.model.group.InternalGroup@eeac4af[id=11599873,name=name-name-name,type=GROUP,active=true,description=Some description,lowerName=name-name-name,createdDate=2014-11-12 22:46:08.32,updatedDate=2014-11-12 23:46:08.798,directoryId=32770] org.hibernate.HibernateException: Illegal attempt to associate a collection with two open sessions at org.hibernate.collection.internal.AbstractPersistentCollection.setCurrentSession(AbstractPersistentCollection.java:633) ~[AbstractPersistentCollection.class:4.3.6.Final] at org.hibernate.event.internal.OnUpdateVisitor.processCollection(OnUpdateVisitor.java:63) ~[OnUpdateVisitor.class:4.3.6.Final] at org.hibernate.event.internal.AbstractVisitor.processValue(AbstractVisitor.java:121) ~[AbstractVisitor.class:4.3.6.Final] at org.hibernate.event.internal.AbstractVisitor.processValue(AbstractVisitor.java:82) ~[AbstractVisitor.class:4.3.6.Final] at org.hibernate.event.internal.AbstractVisitor.processEntityPropertyValues(AbstractVisitor.java:76) ~[AbstractVisitor.class:4.3.6.Final] at org.hibernate.event.internal.AbstractVisitor.process(AbstractVisitor.java:143) ~[AbstractVisitor.class:4.3.6.Final] at org.hibernate.event.internal.DefaultDeleteEventListener.onDelete(DefaultDeleteEventListener.java:120) ~[DefaultDeleteEventListener.class:4.3.6.Final] at org.hibernate.event.internal.DefaultDeleteEventListener.onDelete(DefaultDeleteEventListener.java:73) ~[DefaultDeleteEventListener.class:4.3.6.Final] at org.hibernate.internal.SessionImpl.fireDelete(SessionImpl.java:920) ~[SessionImpl.class:4.3.6.Final] at org.hibernate.internal.SessionImpl.delete(SessionImpl.java:896) ~[SessionImpl.class:4.3.6.Final] at com.atlassian.crowd.util.persistence.hibernate.batch.hibernate4.operation.RemoveGroupOperation.performOperation(RemoveGroupOperation.java:43) ~[RemoveGroupOperation.class:na] at com.atlassian.crowd.util.persistence.hibernate.batch.hibernate4.operation.RemoveGroupOperation.performOperation(RemoveGroupOperation.java:17) ~[RemoveGroupOperation.class:na] at com.atlassian.crowd.util.persistence.hibernate.batch.AbstractBatchProcessor.performOperation(AbstractBatchProcessor.java:212) [AbstractBatchProcessor.class:na] at com.atlassian.crowd.util.persistence.hibernate.batch.AbstractBatchProcessor.processIndividual(AbstractBatchProcessor.java:184) [AbstractBatchProcessor.class:na] at com.atlassian.crowd.util.persistence.hibernate.batch.AbstractBatchProcessor.processBatch(AbstractBatchProcessor.java:168) [AbstractBatchProcessor.class:na] at com.atlassian.crowd.util.persistence.hibernate.batch.AbstractBatchProcessor.execute(AbstractBatchProcessor.java:133) [AbstractBatchProcessor.class:na] at com.atlassian.crowd.dao.group.GroupDAOHibernate.removeAllGroups(GroupDAOHibernate.java:237) [GroupDAOHibernate.class:na] at com.atlassian.crowd.directory.AbstractInternalDirectory.removeAllGroups(AbstractInternalDirectory.java:767) [AbstractInternalDirectory.class:na] at com.atlassian.crowd.directory.DbCachingRemoteChangeOperations.deleteCachedGroups(DbCachingRemoteChangeOperations.java:690) [DbCachingRemoteChangeOperations.class:na] at com.atlassian.crowd.directory.DbCachingRemoteChangeOperations.deleteCachedGroupsNotIn(DbCachingRemoteChangeOperations.java:679) [DbCachingRemoteChangeOperations.class:na] at com.atlassian.crowd.directory.$Proxy1997.deleteCachedGroupsNotIn(Unknown Source) [na:na] at com.atlassian.crowd.directory.DirectoryCacheImplUsingChangeOperations.deleteCachedGroupsNotIn(DirectoryCacheImplUsingChangeOperations.java:99) [DirectoryCacheImplUsingChangeOperations.class:na] at com.atlassian.crowd.directory.ldap.cache.RemoteDirectoryCacheRefresher.synchroniseAllGroups(RemoteDirectoryCacheRefresher.java:113) [RemoteDirectoryCacheRefresher.class:na] at com.atlassian.crowd.directory.ldap.cache.AbstractCacheRefresher.synchroniseAll(AbstractCacheRefresher.java:82) [AbstractCacheRefresher.class:na] at com.atlassian.crowd.directory.ldap.cache.EventTokenChangedCacheRefresher.synchroniseAll(EventTokenChangedCacheRefresher.java:66) [EventTokenChangedCacheRefresher.class:na] at com.atlassian.crowd.directory.DbCachingRemoteDirectory.synchroniseCache(DbCachingRemoteDirectory.java:1120) [DbCachingRemoteDirectory.class:na] at com.atlassian.crowd.manager.directory.DirectorySynchroniserImpl.synchronise(DirectorySynchroniserImpl.java:76) [DirectorySynchroniserImpl.class:na] {noformat}

    Atlassian JIRA | 2 years ago | Bryan Turner
    org.hibernate.HibernateException: Illegal attempt to associate a collection with two open sessions
  3. 0

    When group deletions are synchronized, it's possible for synchronization to fail with an error message like this: {noformat} 2014-11-18 06:41:59,215 ERROR [clusterScheduler_Worker-5] c.a.c.u.p.h.b.AbstractBatchProcessor Could not process class com.atlassian.crowd.model.group.InternalGroup: com.atlassian.crowd.model.group.InternalGroup@eeac4af[id=11599873,name=name-name-name,type=GROUP,active=true,description=Some description,lowerName=name-name-name,createdDate=2014-11-12 22:46:08.32,updatedDate=2014-11-12 23:46:08.798,directoryId=32770] org.hibernate.HibernateException: Illegal attempt to associate a collection with two open sessions at org.hibernate.collection.internal.AbstractPersistentCollection.setCurrentSession(AbstractPersistentCollection.java:633) ~[AbstractPersistentCollection.class:4.3.6.Final] at org.hibernate.event.internal.OnUpdateVisitor.processCollection(OnUpdateVisitor.java:63) ~[OnUpdateVisitor.class:4.3.6.Final] at org.hibernate.event.internal.AbstractVisitor.processValue(AbstractVisitor.java:121) ~[AbstractVisitor.class:4.3.6.Final] at org.hibernate.event.internal.AbstractVisitor.processValue(AbstractVisitor.java:82) ~[AbstractVisitor.class:4.3.6.Final] at org.hibernate.event.internal.AbstractVisitor.processEntityPropertyValues(AbstractVisitor.java:76) ~[AbstractVisitor.class:4.3.6.Final] at org.hibernate.event.internal.AbstractVisitor.process(AbstractVisitor.java:143) ~[AbstractVisitor.class:4.3.6.Final] at org.hibernate.event.internal.DefaultDeleteEventListener.onDelete(DefaultDeleteEventListener.java:120) ~[DefaultDeleteEventListener.class:4.3.6.Final] at org.hibernate.event.internal.DefaultDeleteEventListener.onDelete(DefaultDeleteEventListener.java:73) ~[DefaultDeleteEventListener.class:4.3.6.Final] at org.hibernate.internal.SessionImpl.fireDelete(SessionImpl.java:920) ~[SessionImpl.class:4.3.6.Final] at org.hibernate.internal.SessionImpl.delete(SessionImpl.java:896) ~[SessionImpl.class:4.3.6.Final] at com.atlassian.crowd.util.persistence.hibernate.batch.hibernate4.operation.RemoveGroupOperation.performOperation(RemoveGroupOperation.java:43) ~[RemoveGroupOperation.class:na] at com.atlassian.crowd.util.persistence.hibernate.batch.hibernate4.operation.RemoveGroupOperation.performOperation(RemoveGroupOperation.java:17) ~[RemoveGroupOperation.class:na] at com.atlassian.crowd.util.persistence.hibernate.batch.AbstractBatchProcessor.performOperation(AbstractBatchProcessor.java:212) [AbstractBatchProcessor.class:na] at com.atlassian.crowd.util.persistence.hibernate.batch.AbstractBatchProcessor.processIndividual(AbstractBatchProcessor.java:184) [AbstractBatchProcessor.class:na] at com.atlassian.crowd.util.persistence.hibernate.batch.AbstractBatchProcessor.processBatch(AbstractBatchProcessor.java:168) [AbstractBatchProcessor.class:na] at com.atlassian.crowd.util.persistence.hibernate.batch.AbstractBatchProcessor.execute(AbstractBatchProcessor.java:133) [AbstractBatchProcessor.class:na] at com.atlassian.crowd.dao.group.GroupDAOHibernate.removeAllGroups(GroupDAOHibernate.java:237) [GroupDAOHibernate.class:na] at com.atlassian.crowd.directory.AbstractInternalDirectory.removeAllGroups(AbstractInternalDirectory.java:767) [AbstractInternalDirectory.class:na] at com.atlassian.crowd.directory.DbCachingRemoteChangeOperations.deleteCachedGroups(DbCachingRemoteChangeOperations.java:690) [DbCachingRemoteChangeOperations.class:na] at com.atlassian.crowd.directory.DbCachingRemoteChangeOperations.deleteCachedGroupsNotIn(DbCachingRemoteChangeOperations.java:679) [DbCachingRemoteChangeOperations.class:na] at com.atlassian.crowd.directory.$Proxy1997.deleteCachedGroupsNotIn(Unknown Source) [na:na] at com.atlassian.crowd.directory.DirectoryCacheImplUsingChangeOperations.deleteCachedGroupsNotIn(DirectoryCacheImplUsingChangeOperations.java:99) [DirectoryCacheImplUsingChangeOperations.class:na] at com.atlassian.crowd.directory.ldap.cache.RemoteDirectoryCacheRefresher.synchroniseAllGroups(RemoteDirectoryCacheRefresher.java:113) [RemoteDirectoryCacheRefresher.class:na] at com.atlassian.crowd.directory.ldap.cache.AbstractCacheRefresher.synchroniseAll(AbstractCacheRefresher.java:82) [AbstractCacheRefresher.class:na] at com.atlassian.crowd.directory.ldap.cache.EventTokenChangedCacheRefresher.synchroniseAll(EventTokenChangedCacheRefresher.java:66) [EventTokenChangedCacheRefresher.class:na] at com.atlassian.crowd.directory.DbCachingRemoteDirectory.synchroniseCache(DbCachingRemoteDirectory.java:1120) [DbCachingRemoteDirectory.class:na] at com.atlassian.crowd.manager.directory.DirectorySynchroniserImpl.synchronise(DirectorySynchroniserImpl.java:76) [DirectorySynchroniserImpl.class:na] {noformat}

    Atlassian JIRA | 2 years ago | Bryan Turner
    org.hibernate.HibernateException: Illegal attempt to associate a collection with two open sessions
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Transaction TimeOut when we are using JPA Paging Item reader in Spring batch

    Stack Overflow | 11 months ago | user5912214
    javax.persistence.PersistenceException: org.hibernate.HibernateException: Transaction was rolled back in a different thread!

    Root Cause Analysis

    1. org.hibernate.HibernateException

      Illegal attempt to associate a collection with two open sessions

      at org.hibernate.collection.internal.AbstractPersistentCollection.setCurrentSession()
    2. Hibernate
      SessionImpl.delete
      1. org.hibernate.collection.internal.AbstractPersistentCollection.setCurrentSession(AbstractPersistentCollection.java:633)[AbstractPersistentCollection.class:4.3.6.Final]
      2. org.hibernate.event.internal.OnUpdateVisitor.processCollection(OnUpdateVisitor.java:63)[OnUpdateVisitor.class:4.3.6.Final]
      3. org.hibernate.event.internal.AbstractVisitor.processValue(AbstractVisitor.java:121)[AbstractVisitor.class:4.3.6.Final]
      4. org.hibernate.event.internal.AbstractVisitor.processValue(AbstractVisitor.java:82)[AbstractVisitor.class:4.3.6.Final]
      5. org.hibernate.event.internal.AbstractVisitor.processEntityPropertyValues(AbstractVisitor.java:76)[AbstractVisitor.class:4.3.6.Final]
      6. org.hibernate.event.internal.AbstractVisitor.process(AbstractVisitor.java:143)[AbstractVisitor.class:4.3.6.Final]
      7. org.hibernate.event.internal.DefaultDeleteEventListener.onDelete(DefaultDeleteEventListener.java:120)[DefaultDeleteEventListener.class:4.3.6.Final]
      8. org.hibernate.event.internal.DefaultDeleteEventListener.onDelete(DefaultDeleteEventListener.java:73)[DefaultDeleteEventListener.class:4.3.6.Final]
      9. org.hibernate.internal.SessionImpl.fireDelete(SessionImpl.java:920)[SessionImpl.class:4.3.6.Final]
      10. org.hibernate.internal.SessionImpl.delete(SessionImpl.java:896)[SessionImpl.class:4.3.6.Final]
      10 frames
    3. com.atlassian.crowd
      DirectorySynchroniserImpl.synchronise
      1. com.atlassian.crowd.util.persistence.hibernate.batch.hibernate4.operation.RemoveGroupOperation.performOperation(RemoveGroupOperation.java:43)[RemoveGroupOperation.class:na]
      2. com.atlassian.crowd.util.persistence.hibernate.batch.hibernate4.operation.RemoveGroupOperation.performOperation(RemoveGroupOperation.java:17)[RemoveGroupOperation.class:na]
      3. com.atlassian.crowd.util.persistence.hibernate.batch.AbstractBatchProcessor.performOperation(AbstractBatchProcessor.java:212)[AbstractBatchProcessor.class:na]
      4. com.atlassian.crowd.util.persistence.hibernate.batch.AbstractBatchProcessor.processIndividual(AbstractBatchProcessor.java:184)[AbstractBatchProcessor.class:na]
      5. com.atlassian.crowd.util.persistence.hibernate.batch.AbstractBatchProcessor.processBatch(AbstractBatchProcessor.java:168)[AbstractBatchProcessor.class:na]
      6. com.atlassian.crowd.util.persistence.hibernate.batch.AbstractBatchProcessor.execute(AbstractBatchProcessor.java:133)[AbstractBatchProcessor.class:na]
      7. com.atlassian.crowd.dao.group.GroupDAOHibernate.removeAllGroups(GroupDAOHibernate.java:237)[GroupDAOHibernate.class:na]
      8. com.atlassian.crowd.directory.AbstractInternalDirectory.removeAllGroups(AbstractInternalDirectory.java:767)[AbstractInternalDirectory.class:na]
      9. com.atlassian.crowd.directory.DbCachingRemoteChangeOperations.deleteCachedGroups(DbCachingRemoteChangeOperations.java:690)[DbCachingRemoteChangeOperations.class:na]
      10. com.atlassian.crowd.directory.DbCachingRemoteChangeOperations.deleteCachedGroupsNotIn(DbCachingRemoteChangeOperations.java:679)[DbCachingRemoteChangeOperations.class:na]
      11. com.atlassian.crowd.directory.$Proxy1997.deleteCachedGroupsNotIn(Unknown Source)[na:na]
      12. com.atlassian.crowd.directory.DirectoryCacheImplUsingChangeOperations.deleteCachedGroupsNotIn(DirectoryCacheImplUsingChangeOperations.java:99)[DirectoryCacheImplUsingChangeOperations.class:na]
      13. com.atlassian.crowd.directory.ldap.cache.RemoteDirectoryCacheRefresher.synchroniseAllGroups(RemoteDirectoryCacheRefresher.java:113)[RemoteDirectoryCacheRefresher.class:na]
      14. com.atlassian.crowd.directory.ldap.cache.AbstractCacheRefresher.synchroniseAll(AbstractCacheRefresher.java:82)[AbstractCacheRefresher.class:na]
      15. com.atlassian.crowd.directory.ldap.cache.EventTokenChangedCacheRefresher.synchroniseAll(EventTokenChangedCacheRefresher.java:66)[EventTokenChangedCacheRefresher.class:na]
      16. com.atlassian.crowd.directory.DbCachingRemoteDirectory.synchroniseCache(DbCachingRemoteDirectory.java:1120)[DbCachingRemoteDirectory.class:na]
      17. com.atlassian.crowd.manager.directory.DirectorySynchroniserImpl.synchronise(DirectorySynchroniserImpl.java:76)[DirectorySynchroniserImpl.class:na]
      17 frames