Please try version 2.1. Gary
On Wed, May 27, 2015 at 3:10 PM, Ajay kumar Gour <[email protected]> wrote: > Hi there, > > > > One of the application I am working on is using commons-dbcp-1.2.2.jar. > Below is my data source configuration – > > > > <Resource id="myDS" type="javax.sql.DataSource"> > > JdbcDriver com.mysql.jdbc.Driver > > JdbcUrl jdbc:mysql://localhost:3306/test?relaxAutoCommit=true > > UserName root > > Password **** > > JtaManaged true > > MaxWait 0 > > PoolPreparedStatements true > > MaxOpenPreparedStatements 20 > > MaxActive 5 > > MinEvictableIdleTime 5 minutes > > TimeBetweenEvictionRuns 120000 millisecond > > NumTestsPerEvictionRun 5 > > TestWhileIdle false > > TestOnBorrow true > > ValidationQuery Select 1 from dual > > </Resource> > > > > Problem is, ever since I enabled eviction (also reduced > MaxOpenPreparedStatement value), I am continuously getting following error > > > > Caused by: > com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: No > operations allowed after statement closed. > > at > sun.reflect.GeneratedConstructorAccessor421.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:411) > > at com.mysql.jdbc.Util.getInstance(Util.java:386) > > at > com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1014) > > at > com.mysql.jdbc.SQLError.createSQLException(SQLError.java:988) > > at > com.mysql.jdbc.SQLError.createSQLException(SQLError.java:974) > > at > com.mysql.jdbc.SQLError.createSQLException(SQLError.java:919) > > at > com.mysql.jdbc.StatementImpl.checkClosed(StatementImpl.java:463) > > at > com.mysql.jdbc.PreparedStatement.setInternal(PreparedStatement.java:3819) > > at > com.mysql.jdbc.PreparedStatement.setLong(PreparedStatement.java:3849) > > at > > org.apache.commons.dbcp.DelegatingPreparedStatement.setLong(DelegatingPreparedStatement.java:123) > > at > > org.apache.commons.dbcp.DelegatingPreparedStatement.setLong(DelegatingPreparedStatement.java:123) > > at > > org.apache.commons.dbcp.DelegatingPreparedStatement.setLong(DelegatingPreparedStatement.java:123) > > at org.hibernate.type.LongType.set(LongType.java:42) > > > > I have tried updating dbcp-1.2.2 to dbcp-1.4, but same error. Could > somebody please help me understand why is this happening? Is there a bug in > DBCP’s statement pooling? It seems that statements are getting closed but > they are not removed from the pool. > > > > Thanks, > > -Ajay > -- E-Mail: [email protected] | [email protected] Java Persistence with Hibernate, Second Edition <http://www.manning.com/bauer3/> JUnit in Action, Second Edition <http://www.manning.com/tahchiev/> Spring Batch in Action <http://www.manning.com/templier/> Blog: http://garygregory.wordpress.com Home: http://garygregory.com/ Tweet! http://twitter.com/GaryGregory
