博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
org.hibernate.HibernateException: No Session found for current thread
阅读量:5202 次
发布时间:2019-06-13

本文共 4558 字,大约阅读时间需要 15 分钟。

出现

org.hibernate.HibernateException: No Session found for current threadat org.springframework.orm.hibernate4.SpringSessionContext.currentSession(SpringSessionContext.java:97)at org.hibernate.internal.SessionFactoryImpl.getCurrentSession(SessionFactoryImpl.java:992)at com.infrastructure.project.base.dao.daos.EntityDao.getSession(EntityDao.java:34)at com.infrastructure.project.base.dao.daos.EntityDao.getCriteria(EntityDao.java:64)at com.demo.service.services.AccountService.login(AccountService.java:143)at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)at java.lang.reflect.Method.invoke(Method.java:601)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.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:91)at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)at $Proxy27.login(Unknown Source)at com.lk.ktb.servlet.KTBService.login(KTBService.java:1041)at com.lk.ktb.servlet.KTBService.service(KTBService.java:239)at javax.servlet.http.HttpServlet.service(HttpServlet.java:731)at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:505)at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:169)at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:956)at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:436)at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1078)at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:625)at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:316)at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)at java.lang.Thread.run(Thread.java:722)

原因在于 Account Service 的 login 方法, 没有进行事物管理。 如下:

我之前不小心把

注释掉了, 注释取消了即可。

posted on
2017-05-20 18:00 阅读(
...) 评论(
...)

转载于:https://www.cnblogs.com/FlyAway2013/p/6882750.html

你可能感兴趣的文章
python爬虫之urllib库(三)
查看>>
图形化
查看>>
使用docker进行测试,保存并生成可执行文件
查看>>
关于mysql数据库的DQL语句中的where和having使用
查看>>
[BZOJ4540]序列
查看>>
布同:我的web后台开发技术层次图和经验感受
查看>>
微信小程序---音乐播放和控制
查看>>
大道至简第五章读后感
查看>>
React Native - 5 ListView实现图文混排
查看>>
ZOJ3232
查看>>
URAL1023
查看>>
VHDL数据类型
查看>>
使用pep8 vim插件规范Python代码
查看>>
Linux下找不到动态链接库;
查看>>
JS浮点类型计算
查看>>
oracle ebs Customer Info
查看>>
Android——Fragment详解
查看>>
开发期间的GWT设置---加快编译速度
查看>>
Javascript中无法创建ActiveXObject("WScript.Shell")对象的解决方案
查看>>
Centos 装系统 配置网卡,校准时间
查看>>