The project structure is: Springmvc +hibernate+mysql,
Database connection pool: c3p0
The server is using TOMCAT7
The situation is: 404 errors often occur during access
The process of the experiment was just beginning to think it was a database version, but it was the same with every version, including the operating system, which was tried with windows,linux.
Also tried the network above to change the MySQL configuration file, increase the connection time, but the error is still.
After communicating with our company's Wang sum programmer, we finally got the solution.
Reason is
Hibernate configuration does not necessarily manage the dynamic C3P0
The error message that appears:
HTTP Status 500-request processing failed; Nested exception is Org.springframework.orm.hibernate3.HibernateSystemException:JDBC commit failed; Nested exception is Org.hibernate.TransactionException:JDBC commit failed
Type Exception Report
Message Request processing failed; Nested exception is Org.springframework.orm.hibernate3.HibernateSystemException:JDBC commit failed; Nested exception is Org.hibernate.TransactionException:JDBC commit failed
Description The server encountered an internal error that prevented it from fulfilling this request.
exception
Org.springframework.web.util.NestedServletException:Request processing failed; Nested exception is Org.springframework.orm.hibernate3.HibernateSystemException:JDBC commit failed; Nested exception is Org.hibernate.TransactionException:JDBC commit failed
Org.springframework.orm.hibernate3.HibernateSystemException:JDBC commit failed; Nested exception is Org.hibernate.TransactionException:JDBC commit failed
Com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException:No operations allowed after connection closed.
Com.mysql.jdbc.exceptions.jdbc4.CommunicationsException:Communications link Failure
The last packet successfully received from the server was 149,464 milliseconds ago. The last packet sent successfully to the server was 18,923 milliseconds ago.
Java.net.SocketTimeoutException:Read timed out |
The solution is to change the spring configuration file Applicationcontext.xml to add the relevant configuration
Add the following related configuration to the <beans> tab:
<bean id= "DataSource" class= "Com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method= "Close" > <property name= "Driverclass" value= "${jdbc.driver}"/> <property name= "Jdbcurl" value= "${jdbc.url}"/> <property name= "user" value= "${jdbc.username}"/> <property name= "Password" value= "${jdbc.password}"/> <property name= "initialpoolsize" value= "${connection_pools.initial_pool_size}"/> <property name= "minpoolsize" value= "${connection_pools.min_pool_size}"/> <property name= "maxpoolsize" value= "${connection_pools.max_pool_size}"/> <property name= "MaxIdleTime" value= "${connection_pools.max_idle_time}"/> <property name= "acquireincrement" value= "${connection_pools.acquire_increment}"/> <property name= "Checkouttimeout" value= "${connection_pools.checkout_timeout}"/> <property name= "Testconnectiononcheckin" value= "false"/> <property name= "Testconnectiononcheckout" value= "true"/> <property name= "preferredtestquery" value= "Select 1"/> </bean> |
Configure the server to restart
This article is from the "7422562" blog, please be sure to keep this source http://7432562.blog.51cto.com/7422562/1577594
Hibernate does not support errors caused by C3P0 configuration