org.springframework.dao.DataAccessResourceFailureException

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

Samebug tips0

We couldn't find tips for this exception.

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

Solutions on the web14

  • Stack trace

    • 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(GrailsHibernateTemplate.java:227)[grails-datastore-gorm-hibernate4-5.0.1.RELEASE.jar:na] at org.grails.orm.hibernate.GrailsHibernateTemplate.doExecute(GrailsHibernateTemplate.java:183)[grails-datastore-gorm-hibernate4-5.0.1.RELEASE.jar:na] at org.grails.orm.hibernate.GrailsHibernateTemplate.execute(GrailsHibernateTemplate.java:140)[grails-datastore-gorm-hibernate4-5.0.1.RELEASE.jar:na] at org.grails.orm.hibernate.GrailsHibernateTemplate.execute(GrailsHibernateTemplate.java:110)[grails-datastore-gorm-hibernate4-5.0.1.RELEASE.jar:na] at org.grails.orm.hibernate.AbstractHibernateGormStaticApi.findWhere(AbstractHibernateGormStaticApi.groovy:335)[grails-datastore-gorm-hibernate-core-5.0.1.RELEASE.jar:na] at org.grails.datastore.gorm.GormStaticApi.findWhere(GormStaticApi.groovy:648)[grails-datastore-gorm-5.0.1.RELEASE.jar:na] at org.grails.datastore.gorm.GormEntity$Trait$Helper.findWhere(GormEntity.groovy:830)[grails-datastore-gorm-5.0.1.RELEASE.jar:na] at org.grails.datastore.gorm.GormEntity$Trait$Helper$findWhere.call(Unknown Source)[na:na] at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)[groovy-2.4.5.jar:2.4.5] at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)[groovy-2.4.5.jar:2.4.5] at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:133)[groovy-2.4.5.jar:2.4.5] at com.r2b.security.User.findWhere(User.groovy)[main/:na] at com.r2b.security.User$findWhere.call(Unknown Source)[na:na] at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)[groovy-2.4.5.jar:2.4.5] at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)[groovy-2.4.5.jar:2.4.5] at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125)[groovy-2.4.5.jar:2.4.5] at grails.plugin.springsecurity.userdetails.GormUserDetailsService.$tt__loadUserByUsername(GormUserDetailsService.groovy:60)[spring-security-core-3.0.2.jar:na] at grails.plugin.springsecurity.userdetails.GormUserDetailsService$_loadUserByUsername_closure1.doCall(GormUserDetailsService.groovy)[spring-security-core-3.0.2.jar:na] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)[na:1.8.0_25] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)[na:1.8.0_25] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)[na:1.8.0_25] at java.lang.reflect.Method.invoke(Method.java:483)[na:1.8.0_25] at org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1426)[springloaded-1.2.5.RELEASE.jar:1.2.5.RELEASE] at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)[groovy-2.4.5.jar:2.4.5] at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)[groovy-2.4.5.jar:2.4.5] at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:294)[groovy-2.4.5.jar:2.4.5] at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1019)[groovy-2.4.5.jar:2.4.5] at groovy.lang.Closure.call(Closure.java:426)[groovy-2.4.5.jar:2.4.5] at groovy.lang.Closure.call(Closure.java:442)[groovy-2.4.5.jar:2.4.5] at grails.transaction.GrailsTransactionTemplate$2.doInTransaction(GrailsTransactionTemplate.groovy:96)[grails-core-3.1.1.jar:3.1.1] at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:133)[spring-tx-4.2.4.RELEASE.jar:4.2.4.RELEASE] at grails.transaction.GrailsTransactionTemplate.execute(GrailsTransactionTemplate.groovy:93)[grails-core-3.1.1.jar:3.1.1] at grails.plugin.springsecurity.userdetails.GormUserDetailsService.loadUserByUsername(GormUserDetailsService.groovy)[spring-security-core-3.0.2.jar:na] at grails.plugin.springsecurity.userdetails.GormUserDetailsService.loadUserByUsername(GormUserDetailsService.groovy:71)[spring-security-core-3.0.2.jar:na] at org.springframework.security.authentication.dao.DaoAuthenticationProvider.retrieveUser(DaoAuthenticationProvider.java:114)[spring-security-core-4.0.3.RELEASE.jar:4.0.3.RELEASE] at org.springframework.security.authentication.dao.AbstractUserDetailsAuthenticationProvider.authenticate(AbstractUserDetailsAuthenticationProvider.java:143)[spring-security-core-4.0.3.RELEASE.jar:4.0.3.RELEASE] at org.springframework.security.authentication.ProviderManager.authenticate(ProviderManager.java:167)[spring-security-core-4.0.3.RELEASE.jar:4.0.3.RELEASE] at org.springframework.security.authentication.AuthenticationManager$authenticate.call(Unknown Source)[spring-security-core-4.0.3.RELEASE.jar:4.0.3.RELEASE] at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)[groovy-2.4.5.jar:2.4.5] at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)[groovy-2.4.5.jar:2.4.5] at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125)[groovy-2.4.5.jar:2.4.5] at grails.plugin.springsecurity.rest.RestAuthenticationFilter.doFilter(RestAuthenticationFilter.groovy:104)[spring-security-rest-2.0.0.M2.jar:na] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)[spring-security-web-4.0.3.RELEASE.jar:4.0.3.RELEASE] at grails.plugin.springsecurity.web.authentication.logout.MutableLogoutFilter.doFilter(MutableLogoutFilter.groovy:62)[spring-security-core-3.0.2.jar:na] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)[spring-security-web-4.0.3.RELEASE.jar:4.0.3.RELEASE] at grails.plugin.springsecurity.web.SecurityRequestHolderFilter.doFilter(SecurityRequestHolderFilter.groovy:58)[spring-security-core-3.0.2.jar:na] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)[spring-security-web-4.0.3.RELEASE.jar:4.0.3.RELEASE] at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:213)[spring-security-web-4.0.3.RELEASE.jar:4.0.3.RELEASE] at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:176)[spring-security-web-4.0.3.RELEASE.jar:4.0.3.RELEASE] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)[tomcat-embed-core-8.0.30.jar:8.0.30] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)[tomcat-embed-core-8.0.30.jar:8.0.30] at org.grails.web.servlet.mvc.GrailsWebRequestFilter.doFilterInternal(GrailsWebRequestFilter.java:73)[grails-web-mvc-3.1.1.jar:3.1.1] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)[spring-web-4.2.4.RELEASE.jar:4.2.4.RELEASE] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)[tomcat-embed-core-8.0.30.jar:8.0.30] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)[tomcat-embed-core-8.0.30.jar:8.0.30] at org.grails.web.filters.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:67)[grails-web-mvc-3.1.1.jar:3.1.1] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)[spring-web-4.2.4.RELEASE.jar:4.2.4.RELEASE] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)[tomcat-embed-core-8.0.30.jar:8.0.30] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)[tomcat-embed-core-8.0.30.jar:8.0.30] at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:121)[spring-web-4.2.4.RELEASE.jar:4.2.4.RELEASE] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)[spring-web-4.2.4.RELEASE.jar:4.2.4.RELEASE] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)[tomcat-embed-core-8.0.30.jar:8.0.30] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)[tomcat-embed-core-8.0.30.jar:8.0.30] at org.springframework.boot.actuate.autoconfigure.MetricsFilter.doFilterInternal(MetricsFilter.java:103)[spring-boot-actuator-1.3.2.RELEASE.jar:1.3.2.RELEASE] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)[spring-web-4.2.4.RELEASE.jar:4.2.4.RELEASE] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)[tomcat-embed-core-8.0.30.jar:8.0.30] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)[tomcat-embed-core-8.0.30.jar:8.0.30] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212)[tomcat-embed-core-8.0.30.jar:8.0.30] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)[tomcat-embed-core-8.0.30.jar:8.0.30] at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)[tomcat-embed-core-8.0.30.jar:8.0.30] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)[tomcat-embed-core-8.0.30.jar:8.0.30] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)[tomcat-embed-core-8.0.30.jar:8.0.30] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)[tomcat-embed-core-8.0.30.jar:8.0.30] at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:521)[tomcat-embed-core-8.0.30.jar:8.0.30] at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1096)[tomcat-embed-core-8.0.30.jar:8.0.30] at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:674)[tomcat-embed-core-8.0.30.jar:8.0.30] at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1500)[tomcat-embed-core-8.0.30.jar:8.0.30] at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1456)[tomcat-embed-core-8.0.30.jar:8.0.30] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)[na:1.8.0_25] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)[na:1.8.0_25] at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)[tomcat-embed-core-8.0.30.jar:8.0.30] at java.lang.Thread.run(Thread.java:745)[na:1.8.0_25] Caused by: org.hibernate.HibernateException: No Session found for current thread at org.grails.orm.hibernate.GrailsSessionContext.currentSession(GrailsSessionContext.java:117)[grails-datastore-gorm-hibernate4-5.0.1.RELEASE.jar:na] at org.hibernate.internal.SessionFactoryImpl.getCurrentSession(SessionFactoryImpl.java:1014)[hibernate-core-4.3.11.Final.jar:4.3.11.Final] at org.grails.orm.hibernate.SessionFactoryProxy.getCurrentSession(SessionFactoryProxy.java:148)[grails-datastore-gorm-hibernate4-5.0.1.RELEASE.jar:na] at org.grails.orm.hibernate.GrailsHibernateTemplate.getSession(GrailsHibernateTemplate.java:225)[grails-datastore-gorm-hibernate4-5.0.1.RELEASE.jar:na] ... 81 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

    LukaLuka
    6 times, last one
    Unknown visitor
    Unknown visitorOnce,
    Unknown visitor
    Unknown visitorOnce,
    derproggerderprogger
    Once,