Uploaded image for project: 'Crowd Data Center'
  1. Crowd Data Center
  2. CWD-4281

Make sure that events publishing is wrapped in a transaction

    XMLWordPrintable

Details

    • Our product teams collect and evaluate feedback from a number of different sources. To learn more about how we use customer feedback in the planning process, check out our new feature policy.

    Description

      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:

      [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
      

      Attachments

        Issue Links

          Activity

            People

              sleberrigaud Samuel Le Berrigaud
              sleberrigaud Samuel Le Berrigaud
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: