Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements


  • Give kudos
  • My kudos


  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

org.hibernate.LazyInitializationException when accessing comment.getThread().getCommentable() Edited


I have an event listener in my custom Bitbucket plugin: 


public void onTaskUpdated(TaskUpdatedEvent event) {
    TaskAnchor anchor = event.getTask().getAnchor();
    if (anchor instanceof Comment) {
          Comment comment = (Comment) anchor;
          Commentable commentable = comment.getThread().getCommentable();

when accessing getCommentable() the following exception is thrown:

java.lang.RuntimeException: could not initialize proxy [com.atlassian.stash.internal.comment.InternalCommentThread#2004605] - no Session. Listener: event: com.atlassian.bitbucket.event.task.TaskUpdatedEvent
at com.atlassian.event.internal.SingleParameterMethodListenerInvoker.invoke(
at com.atlassian.diagnostics.internal.platform.event.EventSystemMonitor.invokeMonitored(
at com.atlassian.diagnostics.internal.platform.event.MonitoredListenerInvoker.invoke(
at com.atlassian.stash.internal.event.AsyncBatchingInvokersTransformer$AsyncInvokerBatch.invoke(
at com.atlassian.event.internal.AsynchronousAbleEventDispatcher.lambda$null$0(
at java.util.concurrent.ThreadPoolExecutor.runWorker(
at com.atlassian.stash.internal.event.EventThreadFactory.lambda$createThread$0(
... 1 frame trimmed
Caused by: org.hibernate.LazyInitializationException: could not initialize proxy [com.atlassian.stash.internal.comment.InternalCommentThread#2004605] - no Session
at org.hibernate.proxy.AbstractLazyInitializer.initialize(
at org.hibernate.proxy.AbstractLazyInitializer.getImplementation(
at org.hibernate.proxy.pojo.bytebuddy.ByteBuddyInterceptor.intercept(
at org.hibernate.proxy.ProxyConfiguration$InterceptorDispatcher.intercept(
at com.atlassian.stash.internal.comment.InternalCommentThread$HibernateProxy$fCnlTUBi.getCommentable(Unknown Source)
at com.atlassian.stash.internal.comment.InternalCommentThread$HibernateProxy$fCnlTUBi.getCommentable(Unknown Source)

at com.atlassian.event.internal.SingleParameterMethodListenerInvoker.invoke(
... 9 common frames omitted

adding @Transactional  does'n any effects. How I can restore session inside event listener?



0 answers

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Bitbucket

Powering DevOps with Bitbucket Server & Data Center

Hi everyone, The Cloud team recently announced 12 new DevOps features that help developers ship better code, faster   ! While we’re all excited about the new improvements to Bitbucket ...

1,922 views 0 7
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you