Hibernate does not support errors caused by C3P0 configuration

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.