错误异常:org.hibernate.HibernateException: No Session found for current thread,求助

问题描述

HTTPStatus500-NoSessionfoundforcurrentthreadtypeExceptionreportmessageNoSessionfoundforcurrentthreaddescriptionTheserverencounteredaninternalerrorthatpreventeditfromfulfillingthisrequest.exceptionorg.hibernate.HibernateException:NoSessionfoundforcurrentthreadorg.springframework.orm.hibernate4.SpringSessionContext.currentSession(SpringSessionContext.java:97)org.hibernate.internal.SessionFactoryImpl.getCurrentSession(SessionFactoryImpl.java:1041)cn.tleer.dao.MemberDao.findMember(MemberDao.java:17)cn.tleer.biz.MemberBiz.loginMember(MemberBiz.java:23)cn.tleer.web.MemberAction.doLogin(MemberAction.java:43)sun.reflect.NativeMethodAccessorImpl.invoke0(NativeMethod)sun.reflect.NativeMethodAccessorImpl.invoke(UnknownSource)sun.reflect.DelegatingMethodAccessorImpl.invoke(UnknownSource)java.lang.reflect.Method.invoke(UnknownSource)com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:452)com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:291)com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:254)com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:176)com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:263)org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:68)com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:133)com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:207)com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:207)com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:190)com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)org.apache.struts2.interceptor.MultiselectInterceptor.intercept(MultiselectInterceptor.java:75)com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:94)com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:243)com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:100)com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:141)com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:267)com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:142)com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:166)com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:176)com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164)com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:190)com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:187)com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:52)org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:485)org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77)org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:91)noteThefullstacktraceoftherootcauseisavailableintheApacheTomcat/6.0.41logs.ApacheTomcat/6.0.41

解决方案

解决方案二:
这个错误很常见吧,最好的解决方法就是配置<propertyname="current_session_context_class">thread</property>。
解决方案三:
applicationContext.xml在这文件里配置<propertyname="current_session_context_class">thread</property>出错了Multipleannotationsfoundatthisline:-Nosetterfoundforproperty'current_session_context_class'inclass'org.springframework.jdbc.datasource.DataSourceTransactionManager'-cvc-complex-type.2.3:Element'property'cannothavecharacter[children],becausethetype'scontenttypeiselement-only.-<property>elementforproperty'current_session_context_class'mustspecifyareforvalue

时间: 2024-10-29 06:03:05

错误异常:org.hibernate.HibernateException: No Session found for current thread,求助的相关文章

Spring事务总是报org.hibernate.HibernateException: No Session found for current thread

问题描述 今天搞了一下spring mvc的注解,弄到数据库的时候,向数据库中存数据没办法存入成功,看一下错误代码是org.hibernate.HibernateException: No Session found for current thread,网上找了一些方法一直没解决,哪位帮忙看一下,代码如下 applicationContext-db.xml代码: <?xml version="1.0" encoding="UTF-8"?> <be

org.hibernate.HibernateException: No Session found for current thread

问题描述 hibernate:4.1.6spring:4.0.1 工程启动没错,进入getAllUser页面获得数据库用户信息时报如下错误:  严重: Servlet.service() for servlet springMVC threw exceptionorg.hibernate.HibernateException: No Session found for current threadat org.springframework.orm.hibernate4.SpringSessio

集成shiro 出现org.hibernate.HibernateException: No Session found for current thread

问题描述 在Realm中,方法doGetAuthenticationInfo,通过sysUserService查询,执行正常方法doGetAuthorizationInfo,也是通过sysUserService查询,结果会报错:org.hibernate.HibernateException:NoSessionfoundforcurrentthread同个类中,为什么一个正常,一个会报session找不到请各位大侠帮忙指点!web.xml<filter><filter-name>s

org.hibernate.HibernateException: No Session found for current thread[附web.xml]

问题描述 hibernate:4.1.6spring:4.0.1工程启动没错,进入getAllUser页面获得数据库用户信息时报如下错误:严重:Servlet.service()forservletspringMVCthrewexceptionorg.hibernate.HibernateException:NoSessionfoundforcurrentthreadatorg.springframework.orm.hibernate4.SpringSessionContext.current

ssh整合-使用spring3.X+Hibernate4.X来做项目,报异常 No Session found for current thread

问题描述 使用spring3.X+Hibernate4.X来做项目,报异常 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) at

spring3.2+hibernate4.2 整合 spring security报No Session found for current thread

问题描述 public class SpringSecurityMetaDataSource implements FilterInvocationSecurityMetadataSource {//@Resource(name = "resourceDao")private ResourceDao resourceDao;private static Map<String, Collection<ConfigAttribute>> resourceMap =

spring MVC No Session found for current thread

项目使用springframework 3.2.3.RELEASE,hibernate 4.2.2.Final,使用spring MVC 项目名:exam3 使用数据库:MySQL 和数据库交互时报错: Xml代码   严重: Servlet.service() for servlet [spring2] in context with path [/exam3] threw exception [Request processing failed; nested exception is or

【hibernate】错误:org.hibernate.HibernateException: identifier of an instance of com.agen.entity.Monthdetail was altered from xx to xx

所报错误: org.hibernate.HibernateException: identifier of an instance of com.agen.entity.Monthdetail was altered from 40288f8e5ac675fe015ac67725c40001 to 444b8583-c965-4457-9e44-907b31cf3b92   错误位置:     更改方法:  

org.hibernate.HibernateException: No CurrentSessio

org.hibernate.HibernateException: No CurrentSessionContext configured! 错误,解决方法: hibernate.cfg.xml中添加:        <!-- Enable Hibernate's automatic session context management -->         <property name="current_session_context_class">thre