java.lang.Throwable: com.mysql.jdbc.exceptions.MySQLNonTransientConnectionException: No operations allowed after statement closed.

activemq-dev | Lucio Tarantino (Commented) (JIRA) | 5 years ago
  1. 0

    [AMQ-2534] Broker gets stuck with an error about using a closed JDBC statement - ASF JIRA

    apache.org | 11 months ago
    java.lang.Throwable: com.mysql.jdbc.exceptions.MySQLNonTransientConnectionException: No operations allowed after statement closed.
  2. 0

    This seems to happen after a period of several hours of inactivity. One symptom of the problem is that in the web UI you can see that a queue has a non-zero message count, but clicking on the queue to see the actual messages shows nothing. Config: <persistenceAdapter> <jdbcPersistenceAdapter dataSource="#mysql-ds"/> </persistenceAdapter> <bean id="mysql-ds" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"> <property name="driverClassName" value="com.mysql.jdbc.Driver"/> <property name="url" value="jdbc:mysql://dbserver/activeMQ?relaxAutoCommit=true&amp;autoReconnect=true"/> <property name="username" value="user"/> <property name="password" value="pass"/> <property name="maxActive" value="200"/> <property name="poolPreparedStatements" value="true"/> </bean> Log: 2009-11-27 07:40:25,026 | WARN | Close failed: Already closed. | org.apache.activemq.store.jdbc.TransactionContext | QueueThread:queue://(queue name) java.sql.SQLException: Already closed. at org.apache.commons.dbcp.PoolableConnection.close(PoolableConnection.java:84) at org.apache.commons.dbcp.PoolingDataSource$PoolGuardConnectionWrapper.close(PoolingDataSource.java:181) at org.apache.activemq.store.jdbc.TransactionContext.close(TransactionContext.java:135) at org.apache.activemq.store.jdbc.JDBCMessageStore.getMessageCount(JDBCMessageStore.java:198) at org.apache.activemq.store.ProxyMessageStore.getMessageCount(ProxyMessageStore.java:83) at org.apache.activemq.broker.region.cursors.QueueStorePrefetch.getStoreSize(QueueStorePrefetch.java:63) at org.apache.activemq.broker.region.cursors.AbstractStoreCursor.remove(AbstractStoreCursor.java:185) at org.apache.activemq.broker.region.cursors.StoreQueueCursor.remove(StoreQueueCursor.java:141) at org.apache.activemq.broker.region.Queue.doPageIn(Queue.java:1367) at org.apache.activemq.broker.region.Queue.pageInMessages(Queue.java:1503) at org.apache.activemq.broker.region.Queue.iterate(Queue.java:1178) at org.apache.activemq.thread.DeterministicTaskRunner.runTask(DeterministicTaskRunner.java:84) at org.apache.activemq.thread.DeterministicTaskRunner$1.run(DeterministicTaskRunner.java:41) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) 2009-11-27 07:40:25,027 | ERROR | Failed to get message count | org.apache.activemq.broker.region.cursors.QueueStorePrefetch | QueueThread:queue://(queue name) java.io.IOException: Failed to get Message Count: queue://(queue name). Reason: com.mysql.jdbc.exceptions.MySQLNonTransientConnectionException: No operations allowed after statement closed. at org.apache.activemq.util.IOExceptionSupport.create(IOExceptionSupport.java:33) at org.apache.activemq.store.jdbc.JDBCMessageStore.getMessageCount(JDBCMessageStore.java:196) at org.apache.activemq.store.ProxyMessageStore.getMessageCount(ProxyMessageStore.java:83) at org.apache.activemq.broker.region.cursors.QueueStorePrefetch.getStoreSize(QueueStorePrefetch.java:63) at org.apache.activemq.broker.region.cursors.AbstractStoreCursor.remove(AbstractStoreCursor.java:185) at org.apache.activemq.broker.region.cursors.StoreQueueCursor.remove(StoreQueueCursor.java:141) at org.apache.activemq.broker.region.Queue.doPageIn(Queue.java:1367) at org.apache.activemq.broker.region.Queue.pageInMessages(Queue.java:1503) at org.apache.activemq.broker.region.Queue.iterate(Queue.java:1178) at org.apache.activemq.thread.DeterministicTaskRunner.runTask(DeterministicTaskRunner.java:84) at org.apache.activemq.thread.DeterministicTaskRunner$1.run(DeterministicTaskRunner.java:41) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) Caused by: com.mysql.jdbc.exceptions.MySQLNonTransientConnectionException: No operations allowed after statement closed. at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:888) at com.mysql.jdbc.Statement.checkClosed(Statement.java:380) at com.mysql.jdbc.PreparedStatement.setString(PreparedStatement.java:3374) at org.apache.commons.dbcp.DelegatingPreparedStatement.setString(DelegatingPreparedStatement.java:132) at org.apache.commons.dbcp.DelegatingPreparedStatement.setString(DelegatingPreparedStatement.java:132) at org.apache.activemq.store.jdbc.adapter.DefaultJDBCAdapter.doGetMessageCount(DefaultJDBCAdapter.java:700) at org.apache.activemq.store.jdbc.JDBCMessageStore.getMessageCount(JDBCMessageStore.java:192) ... 12 more 2009-11-27 07:40:25,028 | ERROR | Failed to page in more queue messages | org.apache.activemq.broker.region.Queue | QueueThread:queue://(queue name) java.lang.RuntimeException: java.io.IOException: Failed to get Message Count: queue://(queue name). Reason: com.mysql.jdbc.exceptions.MySQLNonTransientConnectionException: No operations allowed after statement closed. at org.apache.activemq.broker.region.cursors.QueueStorePrefetch.getStoreSize(QueueStorePrefetch.java:66) at org.apache.activemq.broker.region.cursors.AbstractStoreCursor.remove(AbstractStoreCursor.java:185) at org.apache.activemq.broker.region.cursors.StoreQueueCursor.remove(StoreQueueCursor.java:141) at org.apache.activemq.broker.region.Queue.doPageIn(Queue.java:1367) at org.apache.activemq.broker.region.Queue.pageInMessages(Queue.java:1503) at org.apache.activemq.broker.region.Queue.iterate(Queue.java:1178) at org.apache.activemq.thread.DeterministicTaskRunner.runTask(DeterministicTaskRunner.java:84) at org.apache.activemq.thread.DeterministicTaskRunner$1.run(DeterministicTaskRunner.java:41) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) Caused by: java.io.IOException: Failed to get Message Count: queue://(queue name). Reason: com.mysql.jdbc.exceptions.MySQLNonTransientConnectionException: No operations allowed after statement closed. at org.apache.activemq.util.IOExceptionSupport.create(IOExceptionSupport.java:33) at org.apache.activemq.store.jdbc.JDBCMessageStore.getMessageCount(JDBCMessageStore.java:196) at org.apache.activemq.store.ProxyMessageStore.getMessageCount(ProxyMessageStore.java:83) at org.apache.activemq.broker.region.cursors.QueueStorePrefetch.getStoreSize(QueueStorePrefetch.java:63) ... 10 more Caused by: com.mysql.jdbc.exceptions.MySQLNonTransientConnectionException: No operations allowed after statement closed. at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:888) at com.mysql.jdbc.Statement.checkClosed(Statement.java:380) at com.mysql.jdbc.PreparedStatement.setString(PreparedStatement.java:3374) at org.apache.commons.dbcp.DelegatingPreparedStatement.setString(DelegatingPreparedStatement.java:132) at org.apache.commons.dbcp.DelegatingPreparedStatement.setString(DelegatingPreparedStatement.java:132) at org.apache.activemq.store.jdbc.adapter.DefaultJDBCAdapter.doGetMessageCount(DefaultJDBCAdapter.java:700) at org.apache.activemq.store.jdbc.JDBCMessageStore.getMessageCount(JDBCMessageStore.java:192) ... 12 more 2009-11-27 07:40:25,086 | WARN | Close failed: Already closed. | org.apache.activemq.store.jdbc.TransactionContext | QueueThread:queue://(queue name) java.sql.SQLException: Already closed. at org.apache.commons.dbcp.PoolableConnection.close(PoolableConnection.java:84) at org.apache.commons.dbcp.PoolingDataSource$PoolGuardConnectionWrapper.close(PoolingDataSource.java:181) at org.apache.activemq.store.jdbc.TransactionContext.close(TransactionContext.java:135) at org.apache.activemq.store.jdbc.JDBCMessageStore.getMessageCount(JDBCMessageStore.java:198) at org.apache.activemq.store.ProxyMessageStore.getMessageCount(ProxyMessageStore.java:83) at org.apache.activemq.broker.region.cursors.QueueStorePrefetch.getStoreSize(QueueStorePrefetch.java:63) at org.apache.activemq.broker.region.cursors.AbstractStoreCursor.remove(AbstractStoreCursor.java:185) at org.apache.activemq.broker.region.cursors.StoreQueueCursor.remove(StoreQueueCursor.java:141) at org.apache.activemq.broker.region.Queue.doPageIn(Queue.java:1367) at org.apache.activemq.broker.region.Queue.pageInMessages(Queue.java:1503) at org.apache.activemq.broker.region.Queue.iterate(Queue.java:1178) at org.apache.activemq.thread.DeterministicTaskRunner.runTask(DeterministicTaskRunner.java:84) at org.apache.activemq.thread.DeterministicTaskRunner$1.run(DeterministicTaskRunner.java:41) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) 2009-11-27 07:40:25,088 | ERROR | Failed to get message count | org.apache.activemq.broker.region.cursors.QueueStorePrefetch | QueueThread:queue://(queue name) java.io.IOException: Failed to get Message Count: queue://(queue name). Reason: com.mysql.jdbc.exceptions.MySQLNonTransientConnectionException: No operations allowed after statement closed. at org.apache.activemq.util.IOExceptionSupport.create(IOExceptionSupport.java:33) at org.apache.activemq.store.jdbc.JDBCMessageStore.getMessageCount(JDBCMessageStore.java:196) at org.apache.activemq.store.ProxyMessageStore.getMessageCount(ProxyMessageStore.java:83) at org.apache.activemq.broker.region.cursors.QueueStorePrefetch.getStoreSize(QueueStorePrefetch.java:63) at org.apache.activemq.broker.region.cursors.AbstractStoreCursor.remove(AbstractStoreCursor.java:185) at org.apache.activemq.broker.region.cursors.StoreQueueCursor.remove(StoreQueueCursor.java:141) at org.apache.activemq.broker.region.Queue.doPageIn(Queue.java:1367) at org.apache.activemq.broker.region.Queue.pageInMessages(Queue.java:1503) at org.apache.activemq.broker.region.Queue.iterate(Queue.java:1178) at org.apache.activemq.thread.DeterministicTaskRunner.runTask(DeterministicTaskRunner.java:84) at org.apache.activemq.thread.DeterministicTaskRunner$1.run(DeterministicTaskRunner.java:41) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) Caused by: com.mysql.jdbc.exceptions.MySQLNonTransientConnectionException: No operations allowed after statement closed. at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:888) at com.mysql.jdbc.Statement.checkClosed(Statement.java:380) at com.mysql.jdbc.PreparedStatement.setString(PreparedStatement.java:3374) at org.apache.commons.dbcp.DelegatingPreparedStatement.setString(DelegatingPreparedStatement.java:132) at org.apache.commons.dbcp.DelegatingPreparedStatement.setString(DelegatingPreparedStatement.java:132) at org.apache.activemq.store.jdbc.adapter.DefaultJDBCAdapter.doGetMessageCount(DefaultJDBCAdapter.java:700) at org.apache.activemq.store.jdbc.JDBCMessageStore.getMessageCount(JDBCMessageStore.java:192) ... 12 more 2009-11-27 07:40:25,088 | ERROR | Failed to page in more queue messages | org.apache.activemq.broker.region.Queue | QueueThread:queue://(queue name) java.lang.RuntimeException: java.io.IOException: Failed to get Message Count: queue://(queue name). Reason: com.mysql.jdbc.exceptions.MySQLNonTransientConnectionException: No operations allowed after statement closed. at org.apache.activemq.broker.region.cursors.QueueStorePrefetch.getStoreSize(QueueStorePrefetch.java:66) at org.apache.activemq.broker.region.cursors.AbstractStoreCursor.remove(AbstractStoreCursor.java:185) at org.apache.activemq.broker.region.cursors.StoreQueueCursor.remove(StoreQueueCursor.java:141) at org.apache.activemq.broker.region.Queue.doPageIn(Queue.java:1367) at org.apache.activemq.broker.region.Queue.pageInMessages(Queue.java:1503) at org.apache.activemq.broker.region.Queue.iterate(Queue.java:1178) at org.apache.activemq.thread.DeterministicTaskRunner.runTask(DeterministicTaskRunner.java:84) at org.apache.activemq.thread.DeterministicTaskRunner$1.run(DeterministicTaskRunner.java:41) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) Caused by: java.io.IOException: Failed to get Message Count: queue://(queue name). Reason: com.mysql.jdbc.exceptions.MySQLNonTransientConnectionException: No operations allowed after statement closed. at org.apache.activemq.util.IOExceptionSupport.create(IOExceptionSupport.java:33) at org.apache.activemq.store.jdbc.JDBCMessageStore.getMessageCount(JDBCMessageStore.java:196) at org.apache.activemq.store.ProxyMessageStore.getMessageCount(ProxyMessageStore.java:83) at org.apache.activemq.broker.region.cursors.QueueStorePrefetch.getStoreSize(QueueStorePrefetch.java:63) ... 10 more Caused by: com.mysql.jdbc.exceptions.MySQLNonTransientConnectionException: No operations allowed after statement closed. at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:888) at com.mysql.jdbc.Statement.checkClosed(Statement.java:380) at com.mysql.jdbc.PreparedStatement.setString(PreparedStatement.java:3374) at org.apache.commons.dbcp.DelegatingPreparedStatement.setString(DelegatingPreparedStatement.java:132) at org.apache.commons.dbcp.DelegatingPreparedStatement.setString(DelegatingPreparedStatement.java:132) at org.apache.activemq.store.jdbc.adapter.DefaultJDBCAdapter.doGetMessageCount(DefaultJDBCAdapter.java:700) at org.apache.activemq.store.jdbc.JDBCMessageStore.getMessageCount(JDBCMessageStore.java:192) ... 12 more

    Apache's JIRA Issue Tracker | 7 years ago | Marshall Pierce
    java.lang.Throwable: com.mysql.jdbc.exceptions.MySQLNonTransientConnectionException: No operations allowed after statement closed.
  3. 0

    [jira] [Commented] (AMQ-2534) Broker gets stuck with an error about using a closed JDBC statement

    activemq-dev | 5 years ago | Lucio Tarantino (Commented) (JIRA)
    java.lang.Throwable: com.mysql.jdbc.exceptions.MySQLNonTransientConnectionException: No operations allowed after statement closed.
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.lang.Throwable

      com.mysql.jdbc.exceptions.MySQLNonTransientConnectionException: No operations allowed after statement closed.

      at com.mysql.jdbc.SQLError.createSQLException()
    2. MySQL jdbc
      PreparedStatement.setString
      1. com.mysql.jdbc.SQLError.createSQLException(SQLError.java:888)
      2. com.mysql.jdbc.Statement.checkClosed(Statement.java:385)
      3. com.mysql.jdbc.PreparedStatement.setString(PreparedStatement.java:3455)
      3 frames
    3. Commons DBCP
      DelegatingPreparedStatement.setString
      1. org.apache.commons.dbcp.DelegatingPreparedStatement.setString(DelegatingPreparedStatement.java:132)
      2. org.apache.commons.dbcp.DelegatingPreparedStatement.setString(DelegatingPreparedStatement.java:132)
      2 frames
    4. ActiveMQ :: Core
      JDBCMessageStore.removeMessage
      1. org.apache.activemq.store.jdbc.adapter.DefaultJDBCAdapter.getStoreSequenceId(DefaultJDBCAdapter.java:272)
      2. org.apache.activemq.store.jdbc.JDBCMessageStore.getStoreSequenceIdForMessageId(JDBCMessageStore.java:293)
      3. org.apache.activemq.store.jdbc.JDBCMessageStore.removeMessage(JDBCMessageStore.java:148)
      3 frames
    5. ActiveMQ :: Broker
      TransportConnection.processCommitTransactionOnePhase
      1. org.apache.activemq.store.memory.MemoryTransactionStore$4.run(MemoryTransactionStore.java:302)
      2. org.apache.activemq.store.memory.MemoryTransactionStore$Tx.commit(MemoryTransactionStore.java:102)
      3. org.apache.activemq.store.memory.MemoryTransactionStore.commit(MemoryTransactionStore.java:222)
      4. org.apache.activemq.transaction.LocalTransaction.commit(LocalTransaction.java:72)
      5. org.apache.activemq.broker.TransactionBroker.commitTransaction(TransactionBroker.java:173)
      6. org.apache.activemq.broker.MutableBrokerFilter.commitTransaction(MutableBrokerFilter.java:103)
      7. org.apache.activemq.broker.TransportConnection.processCommitTransactionOnePhase(TransportConnection.java:424)
      7 frames
    6. ActiveMQ :: Core
      TransactionInfo.visit
      1. org.apache.activemq.command.TransactionInfo.visit(TransactionInfo.java:100)
      1 frame
    7. ActiveMQ :: Broker
      TransportConnection$1.onCommand
      1. org.apache.activemq.broker.TransportConnection.service(TransportConnection.java:311)
      2. org.apache.activemq.broker.TransportConnection$1.onCommand(TransportConnection.java:185)
      2 frames
    8. AMQ HTTP
      TransportSupport.doConsume
      1. org.apache.activemq.transport.TransportFilter.onCommand(TransportFilter.java:69)
      2. org.apache.activemq.transport.WireFormatNegotiator.onCommand(WireFormatNegotiator.java:113)
      3. org.apache.activemq.transport.InactivityMonitor.onCommand(InactivityMonitor.java:228)
      4. org.apache.activemq.transport.TransportSupport.doConsume(TransportSupport.java:83)
      4 frames
    9. ActiveMQ :: Core
      TcpTransport.run
      1. org.apache.activemq.transport.tcp.TcpTransport.doRun(TcpTransport.java:220)
      2. org.apache.activemq.transport.tcp.TcpTransport.run(TcpTransport.java:202)
      2 frames
    10. Java RT
      Thread.run
      1. java.lang.Thread.run(Thread.java:662)
      1 frame