加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > Java > 正文

java – spring hibernate 5错误已经值[org.springframework.orm

发布时间:2020-12-15 00:00:25 所属栏目:Java 来源:网络整理
导读:我只是在使用 Spring Hibernate事务管理器尝试使用getCurrentSession时升级到hibernate 5并面临以下错误 org.springframework.orm.hibernate5.HibernateTransactionManager 这是错误的完整堆栈跟踪 java.lang.IllegalStateException: Already value [org.spr
我只是在使用 Spring Hibernate事务管理器尝试使用getCurrentSession时升级到hibernate 5并面临以下错误
org.springframework.orm.hibernate5.HibernateTransactionManager

这是错误的完整堆栈跟踪

java.lang.IllegalStateException: Already value [org.springframework.orm.hibernate5.SessionHolder@c05f59] for key [org.hibernate.internal.SessionFactoryImpl@f0db1] bound to thread [http-bio-8080-exec-3]
at org.springframework.transaction.support.TransactionSynchronizationManager.bindResource(TransactionSynchronizationManager.java:190) ~[spring-tx-4.2.2.RELEASE.jar:4.2.2.RELEASE]
at org.springframework.orm.hibernate4.SpringSessionContext.currentSession(SpringSessionContext.java:129) ~[spring-orm-4.2.2.RELEASE.jar:4.2.2.RELEASE]
at org.hibernate.internal.SessionFactoryImpl.getCurrentSession(SessionFactoryImpl.java:692) ~[hibernate-core-5.0.2.Final.jar:5.0.2.Final]
at com.pos.core.repository.persistance.framework.impl.BaseHibernateRepository.getCurrentSession(BaseHibernateRepository.java:42) ~[Core-2.5.2-SNAPSHOT.jar:?]
at com.pos.infrastructure.security.repository.impl.LoginSessionRepositoryImpl.getLoginSessionInfo(LoginSessionRepositoryImpl.java:83) ~[Infrastructure-2.5.2-SNAPSHOT.jar:?]
at com.pos.infrastructure.authentication.services.impl.AuthenticationServiceImpl.checkLoginSessionInfo(AuthenticationServiceImpl.java:1087) ~[Infrastructure-2.5.2-SNAPSHOT.jar:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_60]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_60]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_60]
at java.lang.reflect.Method.invoke(Method.java:497) ~[?:1.8.0_60]
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:302) ~[spring-aop-4.2.2.RELEASE.jar:4.2.2.RELEASE]
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190) ~[spring-aop-4.2.2.RELEASE.jar:4.2.2.RELEASE]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157) ~[spring-aop-4.2.2.RELEASE.jar:4.2.2.RELEASE]
at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99) ~[spring-tx-4.2.2.RELEASE.jar:4.2.2.RELEASE]
at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:281) [spring-tx-4.2.2.RELEASE.jar:4.2.2.RELEASE]
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96) [spring-tx-4.2.2.RELEASE.jar:4.2.2.RELEASE]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) [spring-aop-4.2.2.RELEASE.jar:4.2.2.RELEASE]
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92) [spring-aop-4.2.2.RELEASE.jar:4.2.2.RELEASE]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) [spring-aop-4.2.2.RELEASE.jar:4.2.2.RELEASE]
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207) [spring-aop-4.2.2.RELEASE.jar:4.2.2.RELEASE]
at com.sun.proxy.$Proxy168.checkLoginSessionInfo(Unknown Source) [?:?]
at com.pos.posservice.interceptors.WebServiceInterceptor.checkToken(WebServiceInterceptor.java:161) [WebServiceInterceptor.class:?]

解决方法

我找到了解决这个问题的方法.我正在使用hibernate 4 sf bean.
org.springframework.orm.hibernate4.LocalSessionFactoryBean

我不得不将其更改为hibernate 5 sf bean来解决问题

org.springframework.orm.hibernate5.LocalSessionFactoryBean

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读