commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rodney Waldhoff <rwaldh...@apache.org>
Subject Re: [DBCP] Strange Problems and Errors
Date Wed, 02 Apr 2003 00:58:54 GMT
The negative getNumActive() result suggests you're returning more
connections than you borrow (e.g., returning the same connection mulitple
times.)  You might try changing the return method to print a stack trace
when the active count goes negative, to try to identify where this might
be happening.

This may or may not account for the NPE you see, but it seems like it
could (e.g., you're now dealing with multiple references to the same
connection, and one for those references was evicted and therefore closed
(and released).)

On Tue, 1 Apr 2003 travis@spaceprogram.com wrote:

> 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
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>
>

Mime
View raw message