You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by tr...@spaceprogram.com on 2003/03/28 23:37:40 UTC

Strange Problems with DBCP

Ok, I'm getting some strange behaviour with dbcp as detailed below:

Here is the config for it:

connectionPool = new GenericObjectPool(null);
        connectionPool.setMaxActive(50);
        
        connectionPool.setWhenExhaustedAction(GenericObjectPool.WHEN_EXHAUSTED_GROW);
        connectionPool.setMaxIdle(50);
        connectionPool.setNumTestsPerEvictionRun(5);
        connectionPool.setTestWhileIdle(true);
        connectionPool.setTimeBetweenEvictionRunsMillis(20000);
        connectionPool.setTestOnBorrow(true);
        connectionPool.setTestOnReturn(false);
        connectionPool.setMinEvictableIdleTimeMillis(-1);

        DriverManagerConnectionFactory connectionFactory = new DriverManagerConnectionFactory(dbUrl, props);
        PoolableConnectionFactory poolableConnectionFactory = new PoolableConnectionFactory(connectionFactory,connectionPool,null,null,false,true);
        pool = new PoolingDataSource(connectionPool);


And I am getting this error every couple of minutes:

java.lang.NullPointerException
        at com.mysql.jdbc.Connection.execSQL(Unknown Source)
        at com.mysql.jdbc.Connection.execSQL(Unknown Source)
        at com.mysql.jdbc.Connection.setAutoCommit(Unknown Source)
        at org.apache.commons.dbcp.DelegatingConnection.setAutoCommit(DelegatingConnection.java:237)
        at org.apache.commons.dbcp.PoolableConnectionFactory.activateObject(PoolableConnectionFactory.java$
        at org.apache.commons.pool.impl.GenericObjectPool.borrowObject(Unknown Source)
        at org.apache.commons.dbcp.PoolingDataSource.getConnection(PoolingDataSource.java:110)


Also, when I check pool.getNumActive(); it returns: -7580 .

Idle looks alright though.  Any help would be appreciated cuase it seems that every so often, users are getitng this error (== bad), then you refresh and the error is gone.  

Thanks in advance

Travis Reeder
Space Program
http://www.spaceprogram.com