java.lang.RuntimeException: failed to lazily initialize a collection of role: com.atlassian.crowd.model.application.ApplicationImpl.directoryMappings, could not initialize proxy - no Session

Atlassian JIRA | Samuel Le Berrigaud [Atlassian] | 2 years ago
  1. 0

    [CWD-4281] Make sure that events publishing is wrapped in a transaction - Atlassian JIRA

    atlassian.com | 1 year ago
    java.lang.RuntimeException: failed to lazily initialize a collection of role: com.atlassian.crowd.model.application.ApplicationImpl.directoryMappings, could not initialize proxy - no Session
  2. 0

    Without current transaction any plugin trying to do anything with existing model objects (beyond what's available through services) will face Hibernate initialisation exceptions, for example: {noformat} [INFO] [talledLocalContainer] 16:48:50,409 ERROR com.atlassian.event.internal.AsynchronousAbleEventDispatcher - There was an exception thrown trying to dispatch event [com.atlassian.crowd.event.directory.RemoteDirectorySynchronisedEvent@498e6e57] from the invoker [SingleParameterMethodListenerInvoker{method=public void com.atlassian.hipchat.server.event.SynchronisationCompletedListener.onRemoteDirectorySynchronised(com.atlassian.crowd.event.directory.RemoteDirectorySynchronisedEvent), listener=com.atlassian.hipchat.server.event.SynchronisationCompletedListener@68733902}] [INFO] [talledLocalContainer] java.lang.RuntimeException: failed to lazily initialize a collection of role: com.atlassian.crowd.model.application.ApplicationImpl.directoryMappings, could not initialize proxy - no Session [INFO] [talledLocalContainer] at com.atlassian.event.internal.SingleParameterMethodListenerInvoker.invoke(SingleParameterMethodListenerInvoker.java:54) [INFO] [talledLocalContainer] at com.atlassian.event.internal.AsynchronousAbleEventDispatcher$1$1.run(AsynchronousAbleEventDispatcher.java:48) [INFO] [talledLocalContainer] at com.google.common.util.concurrent.MoreExecutors$SameThreadExecutorService.execute(MoreExecutors.java:253) [INFO] [talledLocalContainer] at com.atlassian.event.internal.AsynchronousAbleEventDispatcher.dispatch(AsynchronousAbleEventDispatcher.java:107) [INFO] [talledLocalContainer] at com.atlassian.event.internal.EventPublisherImpl.invokeListeners(EventPublisherImpl.java:160) [INFO] [talledLocalContainer] at com.atlassian.event.internal.EventPublisherImpl.publish(EventPublisherImpl.java:79) [INFO] [talledLocalContainer] at com.atlassian.crowd.manager.directory.DirectorySynchroniserImpl.synchronise(DirectorySynchroniserImpl.java:89) [INFO] [talledLocalContainer] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [INFO] [talledLocalContainer] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) [INFO] [talledLocalContainer] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [INFO] [talledLocalContainer] at java.lang.reflect.Method.invoke(Method.java:483) [INFO] [talledLocalContainer] at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317) [INFO] [talledLocalContainer] at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183) [INFO] [talledLocalContainer] at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150) [INFO] [talledLocalContainer] at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:96) [INFO] [talledLocalContainer] at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:260) [INFO] [talledLocalContainer] at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:94) [INFO] [talledLocalContainer] at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) [INFO] [talledLocalContainer] at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204) [INFO] [talledLocalContainer] at com.sun.proxy.$Proxy31.synchronise(Unknown Source) [INFO] [talledLocalContainer] at com.atlassian.crowd.directory.DbCachingDirectoryPoller.pollChanges(DbCachingDirectoryPoller.java:50) [INFO] [talledLocalContainer] at com.atlassian.crowd.manager.directory.monitor.poller.DirectoryPollerJobRunner.runJob(DirectoryPollerJobRunner.java:93) [INFO] [talledLocalContainer] at com.atlassian.scheduler.core.JobLauncher.runJob(JobLauncher.java:135) [INFO] [talledLocalContainer] at com.atlassian.scheduler.core.JobLauncher.launchAndBuildResponse(JobLauncher.java:101) [INFO] [talledLocalContainer] at com.atlassian.scheduler.core.JobLauncher.launch(JobLauncher.java:80) [INFO] [talledLocalContainer] at com.atlassian.scheduler.quartz1.Quartz1Job.execute(Quartz1Job.java:32) [INFO] [talledLocalContainer] at org.quartz.core.JobRunShell.run(JobRunShell.java:223) [INFO] [talledLocalContainer] at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:549) [INFO] [talledLocalContainer] Caused by: org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: com.atlassian.crowd.model.application.ApplicationImpl.directoryMappings, could not initialize proxy - no Session [INFO] [talledLocalContainer] at org.hibernate.collection.internal.AbstractPersistentCollection.throwLazyInitializationException(AbstractPersistentCollection.java:569) [INFO] [talledLocalContainer] at org.hibernate.collection.internal.AbstractPersistentCollection.withTemporarySessionIfNeeded(AbstractPersistentCollection.java:188) [INFO] [talledLocalContainer] at org.hibernate.collection.internal.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:548) [INFO] [talledLocalContainer] at org.hibernate.collection.internal.AbstractPersistentCollection.read(AbstractPersistentCollection.java:126) [INFO] [talledLocalContainer] at org.hibernate.collection.internal.PersistentList.iterator(PersistentList.java:138) [INFO] [talledLocalContainer] at com.atlassian.crowd.model.application.ApplicationImpl.getDirectoryMapping(ApplicationImpl.java:260) [INFO] [talledLocalContainer] at com.atlassian.hipchat.server.event.SynchronisationCompletedListener.getHipChatDirectoryMapping(SynchronisationCompletedListener.java:51) [INFO] [talledLocalContainer] at com.atlassian.hipchat.server.event.SynchronisationCompletedListener.isHipChatDirectory(SynchronisationCompletedListener.java:46) [INFO] [talledLocalContainer] at com.atlassian.hipchat.server.event.SynchronisationCompletedListener.onRemoteDirectorySynchronised(SynchronisationCompletedListener.java:34) [INFO] [talledLocalContainer] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [INFO] [talledLocalContainer] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) [INFO] [talledLocalContainer] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [INFO] [talledLocalContainer] at java.lang.reflect.Method.invoke(Method.java:483) [INFO] [talledLocalContainer] at com.atlassian.event.internal.SingleParameterMethodListenerInvoker.invoke(SingleParameterMethodListenerInvoker.java:36) [INFO] [talledLocalContainer] ... 27 more {noformat}

    Atlassian JIRA | 2 years ago | Samuel Le Berrigaud [Atlassian]
    java.lang.RuntimeException: failed to lazily initialize a collection of role: com.atlassian.crowd.model.application.ApplicationImpl.directoryMappings, could not initialize proxy - no Session
  3. 0

    Without current transaction any plugin trying to do anything with existing model objects (beyond what's available through services) will face Hibernate initialisation exceptions, for example: {noformat} [INFO] [talledLocalContainer] 16:48:50,409 ERROR com.atlassian.event.internal.AsynchronousAbleEventDispatcher - There was an exception thrown trying to dispatch event [com.atlassian.crowd.event.directory.RemoteDirectorySynchronisedEvent@498e6e57] from the invoker [SingleParameterMethodListenerInvoker{method=public void com.atlassian.hipchat.server.event.SynchronisationCompletedListener.onRemoteDirectorySynchronised(com.atlassian.crowd.event.directory.RemoteDirectorySynchronisedEvent), listener=com.atlassian.hipchat.server.event.SynchronisationCompletedListener@68733902}] [INFO] [talledLocalContainer] java.lang.RuntimeException: failed to lazily initialize a collection of role: com.atlassian.crowd.model.application.ApplicationImpl.directoryMappings, could not initialize proxy - no Session [INFO] [talledLocalContainer] at com.atlassian.event.internal.SingleParameterMethodListenerInvoker.invoke(SingleParameterMethodListenerInvoker.java:54) [INFO] [talledLocalContainer] at com.atlassian.event.internal.AsynchronousAbleEventDispatcher$1$1.run(AsynchronousAbleEventDispatcher.java:48) [INFO] [talledLocalContainer] at com.google.common.util.concurrent.MoreExecutors$SameThreadExecutorService.execute(MoreExecutors.java:253) [INFO] [talledLocalContainer] at com.atlassian.event.internal.AsynchronousAbleEventDispatcher.dispatch(AsynchronousAbleEventDispatcher.java:107) [INFO] [talledLocalContainer] at com.atlassian.event.internal.EventPublisherImpl.invokeListeners(EventPublisherImpl.java:160) [INFO] [talledLocalContainer] at com.atlassian.event.internal.EventPublisherImpl.publish(EventPublisherImpl.java:79) [INFO] [talledLocalContainer] at com.atlassian.crowd.manager.directory.DirectorySynchroniserImpl.synchronise(DirectorySynchroniserImpl.java:89) [INFO] [talledLocalContainer] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [INFO] [talledLocalContainer] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) [INFO] [talledLocalContainer] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [INFO] [talledLocalContainer] at java.lang.reflect.Method.invoke(Method.java:483) [INFO] [talledLocalContainer] at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317) [INFO] [talledLocalContainer] at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183) [INFO] [talledLocalContainer] at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150) [INFO] [talledLocalContainer] at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:96) [INFO] [talledLocalContainer] at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:260) [INFO] [talledLocalContainer] at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:94) [INFO] [talledLocalContainer] at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) [INFO] [talledLocalContainer] at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204) [INFO] [talledLocalContainer] at com.sun.proxy.$Proxy31.synchronise(Unknown Source) [INFO] [talledLocalContainer] at com.atlassian.crowd.directory.DbCachingDirectoryPoller.pollChanges(DbCachingDirectoryPoller.java:50) [INFO] [talledLocalContainer] at com.atlassian.crowd.manager.directory.monitor.poller.DirectoryPollerJobRunner.runJob(DirectoryPollerJobRunner.java:93) [INFO] [talledLocalContainer] at com.atlassian.scheduler.core.JobLauncher.runJob(JobLauncher.java:135) [INFO] [talledLocalContainer] at com.atlassian.scheduler.core.JobLauncher.launchAndBuildResponse(JobLauncher.java:101) [INFO] [talledLocalContainer] at com.atlassian.scheduler.core.JobLauncher.launch(JobLauncher.java:80) [INFO] [talledLocalContainer] at com.atlassian.scheduler.quartz1.Quartz1Job.execute(Quartz1Job.java:32) [INFO] [talledLocalContainer] at org.quartz.core.JobRunShell.run(JobRunShell.java:223) [INFO] [talledLocalContainer] at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:549) [INFO] [talledLocalContainer] Caused by: org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: com.atlassian.crowd.model.application.ApplicationImpl.directoryMappings, could not initialize proxy - no Session [INFO] [talledLocalContainer] at org.hibernate.collection.internal.AbstractPersistentCollection.throwLazyInitializationException(AbstractPersistentCollection.java:569) [INFO] [talledLocalContainer] at org.hibernate.collection.internal.AbstractPersistentCollection.withTemporarySessionIfNeeded(AbstractPersistentCollection.java:188) [INFO] [talledLocalContainer] at org.hibernate.collection.internal.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:548) [INFO] [talledLocalContainer] at org.hibernate.collection.internal.AbstractPersistentCollection.read(AbstractPersistentCollection.java:126) [INFO] [talledLocalContainer] at org.hibernate.collection.internal.PersistentList.iterator(PersistentList.java:138) [INFO] [talledLocalContainer] at com.atlassian.crowd.model.application.ApplicationImpl.getDirectoryMapping(ApplicationImpl.java:260) [INFO] [talledLocalContainer] at com.atlassian.hipchat.server.event.SynchronisationCompletedListener.getHipChatDirectoryMapping(SynchronisationCompletedListener.java:51) [INFO] [talledLocalContainer] at com.atlassian.hipchat.server.event.SynchronisationCompletedListener.isHipChatDirectory(SynchronisationCompletedListener.java:46) [INFO] [talledLocalContainer] at com.atlassian.hipchat.server.event.SynchronisationCompletedListener.onRemoteDirectorySynchronised(SynchronisationCompletedListener.java:34) [INFO] [talledLocalContainer] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [INFO] [talledLocalContainer] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) [INFO] [talledLocalContainer] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [INFO] [talledLocalContainer] at java.lang.reflect.Method.invoke(Method.java:483) [INFO] [talledLocalContainer] at com.atlassian.event.internal.SingleParameterMethodListenerInvoker.invoke(SingleParameterMethodListenerInvoker.java:36) [INFO] [talledLocalContainer] ... 27 more {noformat}

    Atlassian JIRA | 2 years ago | Samuel Le Berrigaud [Atlassian]
    java.lang.RuntimeException: failed to lazily initialize a collection of role: com.atlassian.crowd.model.application.ApplicationImpl.directoryMappings, could not initialize proxy - no Session
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    GitHub comment 3#142032414

    GitHub | 1 year ago | elkasmi
    org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: com.atlassian.crowd.model.application.ApplicationImpl.directoryMappings, could not initialize proxy - no Session
  6. 0

    Loading Self Referential Relationships Lazily with Spring Data JPA and Hibernate

    Stack Overflow | 1 year ago | Centinul
    org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: demo.Employee.employees, could not initialize proxy - no Session

    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. org.hibernate.LazyInitializationException

      failed to lazily initialize a collection of role: com.atlassian.crowd.model.application.ApplicationImpl.directoryMappings, could not initialize proxy - no Session

      at org.hibernate.collection.internal.AbstractPersistentCollection.throwLazyInitializationException()
    2. Hibernate
      PersistentList.iterator
      1. org.hibernate.collection.internal.AbstractPersistentCollection.throwLazyInitializationException(AbstractPersistentCollection.java:569)
      2. org.hibernate.collection.internal.AbstractPersistentCollection.withTemporarySessionIfNeeded(AbstractPersistentCollection.java:188)
      3. org.hibernate.collection.internal.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:548)
      4. org.hibernate.collection.internal.AbstractPersistentCollection.read(AbstractPersistentCollection.java:126)
      5. org.hibernate.collection.internal.PersistentList.iterator(PersistentList.java:138)
      5 frames
    3. com.atlassian.crowd
      ApplicationImpl.getDirectoryMapping
      1. com.atlassian.crowd.model.application.ApplicationImpl.getDirectoryMapping(ApplicationImpl.java:260)
      1 frame
    4. com.atlassian.hipchat
      SynchronisationCompletedListener.onRemoteDirectorySynchronised
      1. com.atlassian.hipchat.server.event.SynchronisationCompletedListener.getHipChatDirectoryMapping(SynchronisationCompletedListener.java:51)
      2. com.atlassian.hipchat.server.event.SynchronisationCompletedListener.isHipChatDirectory(SynchronisationCompletedListener.java:46)
      3. com.atlassian.hipchat.server.event.SynchronisationCompletedListener.onRemoteDirectorySynchronised(SynchronisationCompletedListener.java:34)
      3 frames
    5. Java RT
      Method.invoke
      1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      4. java.lang.reflect.Method.invoke(Method.java:483)
      4 frames
    6. com.atlassian.event
      AsynchronousAbleEventDispatcher$1$1.run
      1. com.atlassian.event.internal.SingleParameterMethodListenerInvoker.invoke(SingleParameterMethodListenerInvoker.java:36)
      2. com.atlassian.event.internal.AsynchronousAbleEventDispatcher$1$1.run(AsynchronousAbleEventDispatcher.java:48)
      2 frames
    7. Guava
      MoreExecutors$SameThreadExecutorService.execute
      1. com.google.common.util.concurrent.MoreExecutors$SameThreadExecutorService.execute(MoreExecutors.java:253)
      1 frame
    8. com.atlassian.event
      EventPublisherImpl.publish
      1. com.atlassian.event.internal.AsynchronousAbleEventDispatcher.dispatch(AsynchronousAbleEventDispatcher.java:107)
      2. com.atlassian.event.internal.EventPublisherImpl.invokeListeners(EventPublisherImpl.java:160)
      3. com.atlassian.event.internal.EventPublisherImpl.publish(EventPublisherImpl.java:79)
      3 frames
    9. com.atlassian.crowd
      DirectorySynchroniserImpl.synchronise
      1. com.atlassian.crowd.manager.directory.DirectorySynchroniserImpl.synchronise(DirectorySynchroniserImpl.java:89)
      1 frame
    10. Java RT
      Method.invoke
      1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      4. java.lang.reflect.Method.invoke(Method.java:483)
      4 frames
    11. Spring AOP
      ReflectiveMethodInvocation.proceed
      1. org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)
      2. org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
      3. org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
      3 frames
    12. Spring Tx
      TransactionInterceptor.invoke
      1. org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:96)
      2. org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:260)
      3. org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:94)
      3 frames
    13. Spring AOP
      JdkDynamicAopProxy.invoke
      1. org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
      2. org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
      2 frames
    14. com.sun.proxy
      $Proxy31.synchronise
      1. com.sun.proxy.$Proxy31.synchronise(Unknown Source)
      1 frame
    15. com.atlassian.crowd
      DirectoryPollerJobRunner.runJob
      1. com.atlassian.crowd.directory.DbCachingDirectoryPoller.pollChanges(DbCachingDirectoryPoller.java:50)
      2. com.atlassian.crowd.manager.directory.monitor.poller.DirectoryPollerJobRunner.runJob(DirectoryPollerJobRunner.java:93)
      2 frames
    16. com.atlassian.scheduler
      Quartz1Job.execute
      1. com.atlassian.scheduler.core.JobLauncher.runJob(JobLauncher.java:135)
      2. com.atlassian.scheduler.core.JobLauncher.launchAndBuildResponse(JobLauncher.java:101)
      3. com.atlassian.scheduler.core.JobLauncher.launch(JobLauncher.java:80)
      4. com.atlassian.scheduler.quartz1.Quartz1Job.execute(Quartz1Job.java:32)
      4 frames
    17. quartz
      SimpleThreadPool$WorkerThread.run
      1. org.quartz.core.JobRunShell.run(JobRunShell.java:223)
      2. org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:549)
      2 frames