Uploaded image for project: 'Commons DBCP'
  1. Commons DBCP
  2. DBCP-290

java.sql.SQLException: Closed Statement

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Duplicate
    • 1.2.2
    • 1.3
    • None

    Description

      We are getting below exception in production randomly..Using Spring(2.5) JDBC for all our DB related functionality.We don't handle any DB resources directly.everything thru Spring JDBC template. This app was running fine in Weblogic but after migrating to Tomcat6+DBCP(1.2.2) we are seeing the below exception.

      We also looked our code base for any threading or concurrency issues..we were not able spot any issues.

      I have observed one more thing..why checkOpen in DelegatingPreparedStatement didn't catch this but OracleStatement thinks the statement is closed.
      Is it bcos the DBCP is returing the closed connection? (DBCP-273)

      Caused by: org.springframework.jdbc.UncategorizedSQLException: PreparedStatementCallback; uncategorized SQLException for SQL [INSERT INTO AUDIT_TRAIL ( DEAL_ID , AUDIT_TRAIL_ID ) VALUES ( ?,? ) ]; SQL state [null]; error code [17009]; Closed Statement; nested exception is java.sql.SQLException: Closed Statement
      at org.springframework.jdbc.support.SQLStateSQLExceptionTranslator.translate(SQLStateSQLExceptionTranslator.java:124)
      at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.translate(SQLErrorCodeSQLExceptionTranslator.java:322)
      at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:607)
      at org.springframework.jdbc.core.JdbcTemplate.update(JdbcTemplate.java:792)
      at org.springframework.jdbc.core.JdbcTemplate.update(JdbcTemplate.java:815)
      at org.springframework.jdbc.object.SqlUpdate.update(SqlUpdate.java:168)
      at com.dao.DealXAuditTrailDaoBase.insertDealXAuditTrailVoBase(Unknown Source)
      at com.deal.DealTO.insertAuditTrail(DealTO.java:183)
      at com.deal.DealTO.processAuditTrail(DealTO.java:168)
      at com.deal.DealTO.update(DealTO.java:110)
      at com.deal.DealTO$$FastClassByCGLIB$$fba55fe6.invoke(<generated>)
      at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)
      at org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:700)
      at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
      at com.businessrules.SpexBusinessRuleValidator.invoke(SpexBusinessRuleValidator.java:64)
      at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
      at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)
      at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
      at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:635)
      at com.deal.DealTO$$EnhancerByCGLIB$$54d9c9a4.update(<generated>)
      at com.entity.EntityGeneralInfoController.copyFieldsToDeal(EntityGeneralInfoController.java:1158)
      at com.entity.EntityGeneralInfoController.doSave(EntityGeneralInfoController.java:429)
      ... 30 more
      Caused by: java.sql.SQLException: Closed Statement
      at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:125)
      at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:162)
      at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:227)
      at oracle.jdbc.driver.OracleStatement.ensureOpen(OracleStatement.java:3249)
      at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:2867)
      at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:2957)
      at org.apache.tomcat.dbcp.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:102)
      at org.apache.tomcat.dbcp.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:102)
      at org.springframework.jdbc.core.JdbcTemplate$2.doInPreparedStatement(JdbcTemplate.java:798)
      at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:591)

      <Resource name="oracleDS" auth="Container"
      type="javax.sql.DataSource"
      driverClassName="oracle.jdbc.OracleDriver"
      url="jdbc:oracle:thin:@xxxxx:1521:xxxxx"
      username="xxxx" password="xxxx"
      initialSize="2" maxActive="30" maxIdle="30" maxWait="3000" minIdle="0"
      testOnBorrow="true" testOnReturn="false" testWhileIdle="false"
      poolPreparedStatements="true" maxOpenPreparedStatements="10"
      removedAbandoned="true" removeAbandonedTimeout="60"
      logAbandoned="true" validationQuery="select count from dual"/>

      Attachments

        Activity

          People

            Unassigned Unassigned
            ashoknan kan
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: