java.lang.RuntimeException

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

Samebug tips2

Use the proper ORM annotations (@ManyToOne and @OneToMany).

Use eager fetch (fetch = FetchType.EAGER) annotation.

Don't give up yet. Our experts can help. Paste your full stack trace to get a solution.

Solutions on the web143

  • via Unknown by Samuel Le Berrigaud [Atlassian],
  • via Unknown by Samuel Le Berrigaud [Atlassian],
  • Stack trace

    • java.lang.RuntimeException: failed to lazily initialize a collection of role: com.atlassian.crowd.model.application.ApplicationImpl.directoryMappings, could not initialize proxy - no Session at com.atlassian.event.internal.SingleParameterMethodListenerInvoker.invoke(SingleParameterMethodListenerInvoker.java:54) at com.atlassian.event.internal.AsynchronousAbleEventDispatcher$1$1.run(AsynchronousAbleEventDispatcher.java:48) at com.google.common.util.concurrent.MoreExecutors$SameThreadExecutorService.execute(MoreExecutors.java:253) at com.atlassian.event.internal.AsynchronousAbleEventDispatcher.dispatch(AsynchronousAbleEventDispatcher.java:107) at com.atlassian.event.internal.EventPublisherImpl.invokeListeners(EventPublisherImpl.java:160) at com.atlassian.event.internal.EventPublisherImpl.publish(EventPublisherImpl.java:79) at com.atlassian.crowd.manager.directory.DirectorySynchroniserImpl.synchronise(DirectorySynchroniserImpl.java:89) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:483) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317) at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150) at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:96) at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:260) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:94) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204) at com.sun.proxy.$Proxy31.synchronise(Unknown Source) at com.atlassian.crowd.directory.DbCachingDirectoryPoller.pollChanges(DbCachingDirectoryPoller.java:50) at com.atlassian.crowd.manager.directory.monitor.poller.DirectoryPollerJobRunner.runJob(DirectoryPollerJobRunner.java:93) at com.atlassian.scheduler.core.JobLauncher.runJob(JobLauncher.java:135) at com.atlassian.scheduler.core.JobLauncher.launchAndBuildResponse(JobLauncher.java:101) at com.atlassian.scheduler.core.JobLauncher.launch(JobLauncher.java:80) at com.atlassian.scheduler.quartz1.Quartz1Job.execute(Quartz1Job.java:32) at org.quartz.core.JobRunShell.run(JobRunShell.java:223) at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:549) 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 at org.hibernate.collection.internal.AbstractPersistentCollection.throwLazyInitializationException(AbstractPersistentCollection.java:569) at org.hibernate.collection.internal.AbstractPersistentCollection.withTemporarySessionIfNeeded(AbstractPersistentCollection.java:188) at org.hibernate.collection.internal.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:548) at org.hibernate.collection.internal.AbstractPersistentCollection.read(AbstractPersistentCollection.java:126) at org.hibernate.collection.internal.PersistentList.iterator(PersistentList.java:138) at com.atlassian.crowd.model.application.ApplicationImpl.getDirectoryMapping(ApplicationImpl.java:260) at com.atlassian.hipchat.server.event.SynchronisationCompletedListener.getHipChatDirectoryMapping(SynchronisationCompletedListener.java:51) at com.atlassian.hipchat.server.event.SynchronisationCompletedListener.isHipChatDirectory(SynchronisationCompletedListener.java:46) at com.atlassian.hipchat.server.event.SynchronisationCompletedListener.onRemoteDirectorySynchronised(SynchronisationCompletedListener.java:34) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:483) at com.atlassian.event.internal.SingleParameterMethodListenerInvoker.invoke(SingleParameterMethodListenerInvoker.java:36) ... 27 more

    Write tip

    You have a different solution? A short tip here would help you and many other users who saw this issue last week.

    Users with the same issue

    mauritiusmauritius
    5 times, last one
    aidoanaidoan
    3 times, last one
    PilleoPilleo
    Once,
    slashslash
    Once,
    ivanszkypeterivanszkypeter
    132 times, last one
    40 more bugmates