-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: How to fix Too many connections exception; MySQL; C3PO
PostPosted: Mon Jan 25, 2010 5:25 pm 
Newbie

Joined: Wed Jan 06, 2010 9:09 pm
Posts: 14
Hi All,

I'm developing a new web-app using the latest hibernate-distribution-3.3.2.GA and spring-framework-2.5.6. After a while I get the exception below in my app.'s log file. What is actually causing this?

Code:
25 Jan 12:32:56 WARN com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#2 com.mchange.v2.resourcepool.BasicResourcePool - com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@15971ce -- Acquisition Attempt Failed!!! Clearing pending acquires. While trying to acquire a needed new resource, we failed to succeed more than the maximum number of allowed acquisition attempts (30). Last acquisition attempt exception:
com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Too many connections
   at sun.reflect.GeneratedConstructorAccessor134.newInstance(Unknown Source)
   at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
   at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
   at com.mysql.jdbc.Util.handleNewInstance(Util.java:406)
   at com.mysql.jdbc.Util.getInstance(Util.java:381)
   at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:984)
   at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956)
   at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3558)
   at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3490)
   at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:919)
   at com.mysql.jdbc.MysqlIO.secureAuth411(MysqlIO.java:4011)
   at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1284)
   at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2142)
   at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:781)
   at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:46)
   at sun.reflect.GeneratedConstructorAccessor133.newInstance(Unknown Source)
   at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
...


My hibernate.cfg.xml file is:
Code:
<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
        "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
        "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">

<hibernate-configuration>
    <session-factory>
        <!-- Database connection settings -->
        <property name="connection.driver_class">com.mysql.jdbc.Driver</property>
        <property name="connection.url">jdbc:mysql://localhost/snaps</property>
        <property name="connection.username">xxx</property>
        <property name="connection.password">xxx</property>

        <!-- Set up C3P0 JDBC connection pool -->
        <property name="hibernate.c3p0.min_size">5</property>
        <property name="hibernate.c3p0.max_size">20</property>
        <property name="hibernate.c3p0.timeout">1800</property> <!-- seconds -->
        <property name="hibernate.c3p0.max_statements">50</property>

        <!-- SQL dialect -->
        <property name="dialect">org.hibernate.dialect.MySQLInnoDBDialect</property>

        <!-- Enable Hibernate's automatic session context management -->
        <property name="current_session_context_class">thread</property>

        <!-- Disable the second-level cache  -->
        <property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property>

        <!-- Echo all executed SQL to stdout? -->
        <property name="show_sql">false</property>
       
        <mapping resource="various .hbm.xml files listed here"/>       
    </session-factory>
</hibernate-configuration>


Top
 Profile  
 
 Post subject: Re: How to fix Too many connections exception; MySQL; C3PO
PostPosted: Fri Feb 19, 2010 4:51 pm 
Newbie

Joined: Fri Feb 19, 2010 4:49 pm
Posts: 1
Did you resolve this problem?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.