严重: Servlet.service() for servlet [annomvc] in context with path [/joyen-learning] threw exception [Request processing failed; nested exception is org.hibernate.HibernateException: No Session found for current thread] with root cause
org.hibernate.HibernateException: No Session found for current thread
at org.springframework.orm.hibernate4.SpringSessionContext.currentSession(SpringSessionContext.java:106)
at org.hibernate.internal.SessionFactoryImpl.getCurrentSession(SessionFactoryImpl.java:941)
at com.joyen.learning.hibernate.dao.impl.HibernateUserDaoImpl.findUser(HibernateUserDaoImpl.java:23)
at com.joyen.learning.hibernate.service.impl.HibernateUserServiceImpl.findUser(HibernateUserServiceImpl.java:20)
at com.joyen.learning.hibernate.controller.HibernateUserController.login(HibernateUserController.java:26)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:175)
at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:446)
at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:434)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:938)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:870)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:961)
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:852)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:622)
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:837)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:142)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:617)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:518)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1091)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:668)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1527)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1484)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Unknown Source)
org.hibernate.HibernateException: No Session found for current thread
时间: 2024-10-14 20:56:24
org.hibernate.HibernateException: No Session found for current thread的相关文章
spring+hibernate整合:报错org.hibernate.HibernateException: No Session found for current thread
spring+hibernate整合:报错信息如下 org.hibernate.HibernateException: No Session found for current thread at org.springframework.orm.hibernate4.SpringSessionContext.currentSession(SpringSessionContext.java:106) at org.hibernate.internal.SessionFactoryImpl.getC
分析 org.hibernate.HibernateException: No Session found for current thread
/** * * org.hibernate.HibernateException: No Session found for current thread * 分析:getCurrentSession()和当前事务有关系 * * Spring hibernate 事务的流程 * * 1.在方法开始之前 * ①.获取Session * ②.把Session 和当前线程绑定,这样
hibernate在使用getCurrentSession时提示no session found for current thread
大致错误片段 org.hibernate.HibernateException: No Session found for current thread at org.springframework.orm.hibernate4.SpringSessionContext.currentSession(SpringSessionContext.java:97) 大致问题:hibernate在处理sessoin SessionFactory的getCurrentSession并不能保证在没有当前Se
关于spring3中No Session found for current thread!and Transaction的配置和管理(转)
今天我是特别的郁闷,本来项目做到一半,以前都好好的,结果下午就出现问题,苦逼的到现在才解决.它出现问题的时候都一声不坑, ,(天啦,现在才发现CSDN啥时候把QQ表情给整过来了)就在注册用户的时候,咦,后台发现咋SQL语句特么的不对劲,仔细一看数据根本就没有送到数据库去,只是简单的执行了一下查询操作,当时我就震惊了.首先就去看了Action是否没有写save方法,结果是没有任何错误.后来我再去再其他业务层是否也出现了问题,结果都能正常操作,让我哭笑不得.后来只能查配置.当时我就看到这两个配置是在
Hibernate4 No Session found for current thread
Hibernate4 与 spring3 集成之后, 如果在取得session 的地方使用了getCurrentSession, 可能会报一个错:“No Session found for current thread”, 这个错误的原因,网上有很多解决办法, 但具体原因的分析,却没有多少, 这里转载一个原理分析: SessionFactory的getCurrentSession并不能保证在没有当前Session的情况下会自动创建一个新的,这取决于CurrentSessionContext的实现
SSH2 No Session found for current thread原因
Hibernate4 与 spring3 集成之后, 如果在取得session 的地方使用了getCurrentSession, 可能会报一个错:"No Session found for current thread", 这个错误的原因,网上有很多解决办法, 但具体原因的分析,却没有多少, 这里转载一个原理分析: SessionFactory的getCurrentSession并不能保证在没有当前Session的情况下会自动创建一个新的,这取决于CurrentSessionConte
Hibernate4 No Session found for current thread原因
Hibernate4 与 spring3 集成之后, 如果在取得session 的地方使用了getCurrentSession, 可能会报一个错:“No Session found for current thread”, 这个错误的原因,网上有很多解决办法, 但具体原因的分析,却没有多少, 这里转载一个原理分析: SessionFactory的getCurrentSession并不能保证 在没有当前Session的情况下会自动创建一个新的,这取决于CurrentSessionContext的实
SpringMVC4+Hibernate4运行报错Could not obtain transaction-synchronized Session for current thread
查了一下相关资料,整理如下: 原因:Hibernate4 No Session found for current thread原因 解决方法: 1. 在spring 配置文件中加入 程序代码 <tx:annotation-driven transaction-manager="transactionManager"/> 并且在处理业务逻辑的类上采用注解 程序代码 @Service public class CustomerServiceImpl implements
org.hibernate.HibernateException: Could not obtain transaction-synchronized Session for current thread
spring与hibernate整合报错 org.hibernate.HibernateException: Could not obtain transaction-synchronized Session for current thread org.springframework.orm.hibernate4.SpringSessionContext.currentSession(SpringSessionContext.java:134) org.hibernate.internal.S