Return-Path: Mailing-List: contact commons-user-help@jakarta.apache.org; run by ezmlm Delivered-To: mailing list commons-user@jakarta.apache.org Received: (qmail 58041 invoked from network); 2 Apr 2003 00:58:56 -0000 Received: from icarus.apache.org (208.185.179.13) by daedalus.apache.org with SMTP; 2 Apr 2003 00:58:56 -0000 Received: (qmail 44232 invoked by uid 1304); 2 Apr 2003 00:58:55 -0000 Received: from localhost (sendmail-bs@127.0.0.1) by localhost with SMTP; 2 Apr 2003 00:58:55 -0000 Date: Tue, 1 Apr 2003 16:58:54 -0800 (PST) From: Rodney Waldhoff To: Jakarta Commons Users List Subject: Re: [DBCP] Strange Problems and Errors In-Reply-To: <4356277.1049230279875.JavaMail.SYSTEM@bodisafa> Message-ID: <20030401165613.N31537@icarus.apache.org> References: <4356277.1049230279875.JavaMail.SYSTEM@bodisafa> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Spam-Rating: localhost 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N 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 > >