org.springframework.dao.DataAccessResourceFailureException: Could not obtain current Hibernate Session; nested exception is org.hibernate.HibernateException: No Session found for current thread

GitHub | saw303 | 7 months ago
tip
Click on the to mark the solution that helps you, Samebug will learn from it.
As a community member, you’ll be rewarded for you help.
  1. 0

    Unit testing services with Hibernate is broken

    GitHub | 7 months ago | saw303
    org.springframework.dao.DataAccessResourceFailureException: Could not obtain current Hibernate Session; nested exception is org.hibernate.HibernateException: No Session found for current thread

  1. Luka 1 times, last 6 months ago

Root Cause Analysis

  1. org.springframework.dao.DataAccessResourceFailureException

    Could not obtain current Hibernate Session; nested exception is org.hibernate.HibernateException: No Session found for current thread

    at org.grails.orm.hibernate.GrailsHibernateTemplate.getSession()
  2. Grails GORM
    HibernateGormStaticApi.list
    1. org.grails.orm.hibernate.GrailsHibernateTemplate.getSession(GrailsHibernateTemplate.java:274)
    2. org.grails.orm.hibernate.GrailsHibernateTemplate.doExecute(GrailsHibernateTemplate.java:230)
    3. org.grails.orm.hibernate.GrailsHibernateTemplate.execute(GrailsHibernateTemplate.java:187)
    4. org.grails.orm.hibernate.GrailsHibernateTemplate.execute(GrailsHibernateTemplate.java:110)
    5. org.grails.orm.hibernate.HibernateGormStaticApi.list(HibernateGormStaticApi.groovy:70)
    6. org.grails.orm.hibernate.HibernateGormStaticApi.list(HibernateGormStaticApi.groovy:69)
    6 frames
  3. Grails GORM
    GormEntity$Trait$Helper.list
    1. org.grails.datastore.gorm.GormEntity$Trait$Helper.list(GormEntity.groovy:654)
    1 frame
  4. grails.issues
    SeasonService.findAll_closure1
    1. grails.issues.SeasonService.$tt__findAll(SeasonService.groovy:10)
    2. grails.issues.SeasonService.findAll_closure1(SeasonService.groovy)
    2 frames
  5. Groovy
    Closure.call
    1. groovy.lang.Closure.call(Closure.java:414)
    2. groovy.lang.Closure.call(Closure.java:430)
    2 frames
  6. Grails
    GrailsTransactionTemplate$2.doInTransaction
    1. grails.transaction.GrailsTransactionTemplate$2.doInTransaction(GrailsTransactionTemplate.groovy:96)
    1 frame
  7. Spring Tx
    TransactionTemplate.execute
    1. org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:133)
    1 frame
  8. Grails
    GrailsTransactionTemplate.execute
    1. grails.transaction.GrailsTransactionTemplate.execute(GrailsTransactionTemplate.groovy:93)
    1 frame