事务配置不对导致:?Could not obtain transaction-synchronized Session for current thread
Posted 奔跑吧_兄弟!
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了事务配置不对导致:?Could not obtain transaction-synchronized Session for current thread相关的知识,希望对你有一定的参考价值。
Struts has detected an unhandled exception:
Messages: ?Could not obtain transaction-synchronized Session for current thread
File: org/springframework/orm/hibernate5/SpringSessionContext.java
Line number: 132
Stacktraces
org.hibernate.HibernateException: Could not obtain transaction-synchronized Session for current thread
org.springframework.orm.hibernate5.SpringSessionContext.currentSession(SpringSessionContext.java:132)
org.hibernate.internal.SessionFactoryImpl.getCurrentSession(SessionFactoryImpl.java:687)
com.com.service.DepartmentDao.getSeesion(DepartmentDao.java:20)
com.com.service.DepartmentDao.getAll(DepartmentDao.java:26)
com.com.service.DepartmentService.getAll(DepartmentService.java:19)
com.actions.DepartmentAction.list(DepartmentAction.java:28)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
java.lang.reflect.Method.invoke(Method.java:498)
ognl.OgnlRuntime.invokeMethod(OgnlRuntime.java:870)
ognl.OgnlRuntime.callAppropriateMethod(OgnlRuntime.java:1293)
原本目标路径是:com.com.service 在
expression="execution(* com.*.*(..))"/>
就出现此错误。
把目标路径修改为:com.service后,在
expression="execution(* com.service.*.*(..))"/>
解决。
!--more-->
以上是关于事务配置不对导致:?Could not obtain transaction-synchronized Session for current thread的主要内容,如果未能解决你的问题,请参考以下文章
解决Xshell:Could not connect to ‘192.168.88.0‘ (port 22): Connection failed
Java--使用@Autowired报错Could not autowire. No beans of ‘XX‘ type found.
使用 Gradle 编译 Java 项目时报错: Could not find Tools.jar
org.hibernate.HibernateException: Could not obtain transaction-synchronized Session for current thre
Could not resolve placeholder 'driver' in string value "${driver}