commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jason Novotny <jason.novo...@gmail.com>
Subject apache dbcp + mysql reconnect problem
Date Mon, 22 Jun 2009 20:21:08 GMT

Hi,

    My application connects to the database maybe once a day. The first 
time after I startup my app everything works fine, however the next day 
when it tries to connect to the MySql database I get an exception posted 
at the end.

I'm using spring 2.6+hibernate 3.4+apache dbcp+ MySql 5.0.44...  the 
dbcp configuration in Spring looks like:

 <bean id="dataSource" destroy-method="close" 
class="org.apache.commons.dbcp.BasicDataSource">
        <property name="driverClassName" value="${jdbc.driverClassName}"/>
        <property name="url" value="${jdbc.url}"/>
        <property name="username" value="${jdbc.username}"/>
        <property name="password" value="${jdbc.password}"/>
        <property name="maxActive" value="15"/>
        <property name="maxIdle" value="5"/>
        <property name="maxWait" value="120000"/>
    </bean>

Wondering is someone has any idea how to solve this problem...


Caused by: org.hibernate.TransactionException: JDBC begin failed:
    at 
org.hibernate.transaction.JDBCTransaction.begin(JDBCTransaction.java:96)
    at 
org.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:1353)
    at 
org.springframework.orm.hibernate3.HibernateTransactionManager.doBegin(HibernateTransactionManager.java:558)
    ... 8 more
Caused by: com.mysql.jdbc.CommunicationsException: Communications link 
failure due to underlying exception:

** BEGIN NESTED EXCEPTION **

java.io.EOFException

STACKTRACE:

java.io.EOFException
    at com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:1956)
    at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2368)
    at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2867)
    at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1616)
    at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1708)
    at com.mysql.jdbc.Connection.execSQL(Connection.java:3249)
    at com.mysql.jdbc.Connection.setAutoCommit(Connection.java:5392)
    at 
org.apache.commons.dbcp.DelegatingConnection.setAutoCommit(DelegatingConnection.java:331)
    at 
org.apache.commons.dbcp.PoolingDataSource$PoolGuardConnectionWrapper.setAutoCommit(PoolingDataSource.java:317)
    at 
org.hibernate.transaction.JDBCTransaction.begin(JDBCTransaction.java:91)
    at 
org.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:1353)
    at 
org.springframework.orm.hibernate3.HibernateTransactionManager.doBegin(HibernateTransactionManager.java:558)
    at 
org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:374)
    at 
org.springframework.transaction.interceptor.TransactionAspectSupport.createTransactionIfNecessary(TransactionAspectSupport.java:263)
    at 
org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:101)
    at 
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
    at 
org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
    at $Proxy24.hasSymbol(Unknown Source)
    at 
com.quantstock.services.web.impl.cxf.tasks.UpdateQuotesTask.run(UpdateQuotesTask.java:91)
    at java.lang.Thread.run(Thread.java:619)


** END NESTED EXCEPTION **



Last packet sent to the server was 1 ms ago.
    at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2579)
    at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2867)
    at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1616)
    at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1708)
    at com.mysql.jdbc.Connection.execSQL(Connection.java:3249)
    at com.mysql.jdbc.Connection.setAutoCommit(Connection.java:5392)
    at 
org.apache.commons.dbcp.DelegatingConnection.setAutoCommit(DelegatingConnection.java:331)
    at 
org.apache.commons.dbcp.PoolingDataSource$PoolGuardConnectionWrapper.setAutoCommit(PoolingDataSource.java:317)
    at 
org.hibernate.transaction.JDBCTransaction.begin(JDBCTransaction.java:91)
    ... 10 more


Thanks, Jason

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Mime
View raw message