If you encounter the above exceptions, I am afraid it is a problem with your data source configuration. First, you can eliminate some possibilities. For example, if the data source is okay, that is, the DataSource is okay, you can further determine the problem. At the beginning, I also felt very unfamiliar with this exception. Many problems still need to be solved by myself. After I redo this experiment, I found that this problem was caused by some problems in your SessionFactory annotation. To be sure, you need to understand the problems of the getCurrentSession () and openSession () methods in the Session. This is the essence of this issue. Focus on understanding how spring manages transactions and hibernate sessions in the SSH architecture. 1. getCurrentSession () must be committed. Therefore, you must configure declarative transaction management when using session. getCurrentSession. For specific declarative management, you can go to the Internet and google to know how to configure it. 2. openSession () is exactly the same as the above method. It does not need to commit transactions. However, the resource must be disabled manually. There are two simple solutions: 1. You can use openSession to obtain the session. 2. If getCurrenctSession () is used, configure <prop key = "hibernate. current_session_context_class "> thread </prop> <prop key =" hibernate. transaction. factory_class "> org. hibernate. transaction. which of the following links is JDBCTransactionFactory </prop>? Xml version = "1.0" encoding = "UTF-8"?> <Beans xmlns = "http://www.springframework.org/schema/beans" xmlns: xsi = "http://www.w3.org/2001/XMLSchema-instance" xmlns: context = "http://www.springframework.org/schema/context" xmlns: aop = "http://www.springframework.org/schema/aop" xmlns: tx = "http://www.springframework.org/schema/tx" xsi: schemaLocation = "http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans -2.5.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd "> <context: annotation-config/> <context: component-scan base-package =" com. Ssh. test "/> <bean id =" dataSource "class =" org. apache. commons. dbcp. basicDataSource "destroy-method =" close "> <property name =" driverClassName "value =" com. mysql. jdbc. driver "/> <property name =" url "value =" jdbc: mysql: // localhost/spring "/> <property name =" username "value =" root "/> <property name =" password "value =" root "/> </bean> <bean id = "sessionFactory" class = "org. springframework. orm. hibernate3.anno Tation. annotationSessionFactoryBean "> <property name =" dataSource "ref =" dataSource "/> <property name =" packagesToScan "> <list> <value> com. ssh. test. model </value> </list> </property> <property name = "hibernateProperties"> <props> <prop key = "hibernate. dialect "> org. hibernate. dialect. mySQLDialect </prop> <prop key = "hibernate. show_ SQL "> true </prop> <! -- <Prop key = "hibernate. current_session_context_class "> thread </prop> <prop key =" hibernate. transaction. factory_class "> org. hibernate. transaction. JDBCTransactionFactory </prop> --> </props> </property> </bean> </beans>