commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ajay kumar Gour <ajay.g...@gmail.com>
Subject [dbcp] No operations allowed after statement closed
Date Wed, 27 May 2015 22:10:17 GMT
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

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message