Uploaded image for project: 'Hibernate ORM'
  1. Hibernate ORM
  2. HHH-8853

Tomcat jdbc-pool interceptor exception

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 4.3.0.Final
    • Fix Version/s: 4.3.2
    • Component/s: core
    • Labels:
      None
    • Environment:
      Hibernate 4.3.0.Final, Mysql 5.5, Tomcat 7
    • Bug Testcase Reminder (view):

      Bug reports should generally be accompanied by a test case!

    • Last commented by a user?:
      true

      Description

      After update hibernate from 4.1.8.Final to 4.3.0.Final tomcat jdbc-pool start throwing this exceptions.

      ...
      Caused by: java.lang.reflect.UndeclaredThrowableException: null
      	at com.sun.proxy.$Proxy72.hashCode(Unknown Source) ~[na:na]
      	at java.util.HashMap.hash(HashMap.java:351) ~[na:1.7.0_25]
      	at java.util.HashMap.getEntry(HashMap.java:443) ~[na:1.7.0_25]
      	at java.util.HashMap.get(HashMap.java:405) ~[na:1.7.0_25]
      	at org.hibernate.engine.jdbc.internal.JdbcCoordinatorImpl.release(JdbcCoordinatorImpl.java:399) ~[hibernate-core-4.3.0.Final.jar:4.3.0.Final]
      	at org.hibernate.engine.jdbc.batch.internal.AbstractBatchImpl.releaseStatements(AbstractBatchImpl.java:173) ~[hibernate-core-4.3.0.Final.jar:4.3.0.Final]
      	at org.hibernate.engine.jdbc.batch.internal.NonBatchingBatch.addToBatch(NonBatchingBatch.java:76) ~[hibernate-core-4.3.0.Final.jar:4.3.0.Final]
      	at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:3124) ~[hibernate-core-4.3.0.Final.jar:4.3.0.Final]
      	at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:3587) ~[hibernate-core-4.3.0.Final.jar:4.3.0.Final]
      	at org.hibernate.action.internal.EntityInsertAction.execute(EntityInsertAction.java:103) ~[hibernate-core-4.3.0.Final.jar:4.3.0.Final]
      	at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:453) ~[hibernate-core-4.3.0.Final.jar:4.3.0.Final]
      	at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:345) ~[hibernate-core-4.3.0.Final.jar:4.3.0.Final]
      	at org.hibernate.event.internal.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:350) ~[hibernate-core-4.3.0.Final.jar:4.3.0.Final]
      	at org.hibernate.event.internal.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:56) ~[hibernate-core-4.3.0.Final.jar:4.3.0.Final]
      	at org.hibernate.internal.SessionImpl.flush(SessionImpl.java:1218) ~[hibernate-core-4.3.0.Final.jar:4.3.0.Final]
      	at org.hibernate.internal.SessionImpl.managedFlush(SessionImpl.java:421) ~[hibernate-core-4.3.0.Final.jar:4.3.0.Final]
      	at org.hibernate.engine.transaction.internal.jdbc.JdbcTransaction.beforeTransactionCommit(JdbcTransaction.java:101) ~[hibernate-core-4.3.0.Final.jar:4.3.0.Final]
      	at org.hibernate.engine.transaction.spi.AbstractTransactionImpl.commit(AbstractTransactionImpl.java:177) ~[hibernate-core-4.3.0.Final.jar:4.3.0.Final]
      	at org.hibernate.jpa.internal.TransactionImpl.commit(TransactionImpl.java:77) ~[hibernate-entitymanager-4.3.0.Final.jar:4.3.0.Final]
      	... 90 common frames omitted
      Caused by: java.sql.SQLException: Statement closed.
      	at org.apache.tomcat.jdbc.pool.interceptor.AbstractQueryReport$StatementProxy.invoke(AbstractQueryReport.java:225) ~[tomcat-jdbc.jar:na]
      	... 109 common frames omitted
      

      Next block contains AbstractQueryReport code, lines between 215 and 226

      @Override
              public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
                  //get the name of the method for comparison
                  final String name = method.getName();
                  //was close invoked?
                  boolean close = compare(JdbcInterceptor.CLOSE_VAL,name);
                  //allow close to be called multiple times
                  if (close && closed) return null;
                  //are we calling isClosed?
                  if (compare(JdbcInterceptor.ISCLOSED_VAL,name)) return Boolean.valueOf(closed);
                  //if we are calling anything else, bail out
                  if (closed) throw new SQLException("Statement closed.");
      

      So looks like the code at 9ce5c32dd7d11bc13c659f98ee4cc29b26c2e70e it's not jdbc-pool friendly. Specifically the line JdbcCoordinatorImpl.java:399

      final Set<ResultSet> resultSets = xref.get( statement );
      

      To reproduce the exceptions just add some interceptor. For example add the next line to your server.xml resource configuration.

      jdbcInterceptors="ConnectionState;StatementFinalizer;ResetAbandonedTimer;"
      

      The exception in this description was thrown by the ResetAbandonedTimer interceptor.

        Issue Links

          Activity

          Hide
          lukasz.antoniak Lukasz Antoniak added a comment -

          Brett Meyer, modifications done by Steve Ebersole fixed my issue. Thanks a lot!

          Show
          lukasz.antoniak Lukasz Antoniak added a comment - Brett Meyer , modifications done by Steve Ebersole fixed my issue. Thanks a lot!
          Hide
          kwon37xi Son KwonNam added a comment -

          Hibernate 4.2.x has the same problem.
          Please make a fix for 4.2.x.

          Show
          kwon37xi Son KwonNam added a comment - Hibernate 4.2.x has the same problem. Please make a fix for 4.2.x.
          Hide
          sndyuk Yuki Sanada added a comment -

          @steve,
          The patch should be apply for 4.2.x too! (HHH-9413)
          Otherwise, logs of a database is full of the ``

          Show
          sndyuk Yuki Sanada added a comment - @steve, The patch should be apply for 4.2.x too! ( HHH-9413 ) Otherwise, logs of a database is full of the ``
          Hide
          sndyuk Yuki Sanada added a comment -

          @steve,
          The patch should be apply for 4.2.x too! (HHH-9413)
          Otherwise, logs of a database is full of the ``

          Show
          sndyuk Yuki Sanada added a comment - @steve, The patch should be apply for 4.2.x too! ( HHH-9413 ) Otherwise, logs of a database is full of the ``
          Hide
          sndyuk Yuki Sanada added a comment -

          (Sorry, my bad that duplicates comment.. I can't edit / delete previous comment.)

          Show
          sndyuk Yuki Sanada added a comment - (Sorry, my bad that duplicates comment.. I can't edit / delete previous comment.)

            People

            • Votes:
              3 Vote for this issue
              Watchers:
              9 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - Not Specified
                Not Specified
                Logged:
                Time Spent - 38m
                38m

                  Development