title: How to fix Unchecked throwable in managedConnectionReconnected() in Wildfly?
body: <p>We see in our logs a big amount of these errors (1k per second)</p>
  
  <blockquote>
    <p>ERROR [org.hibernate.engine.jdbc.spi.SqlExceptionHelper]
    (EE-ManagedScheduledExecutorService-default-Thread-1)
    javax.resource.ResourceException: IJ000457: Unchecked throwable in
    managedConnectionReconnected()
    cl=org.jboss.jca.core.connectionmanager.listener.TxConnectionListener@7cf06c5e[state=NORMAL
    managed
    connection=org.jboss.jca.adapters.jdbc.local.LocalManagedConnection@6cecd5f4
    connection handles=0 lastReturned=1589648691492
    lastValidated=1589648383871 lastCheckedOut=1589648390322
    trackByTx=false
    pool=org.jboss.jca.core.connectionmanager.pool.strategy.OnePool@5755db92
    mcp=SemaphoreConcurrentLinkedQueueManagedConnectionPool@7c0f33f2[pool=OAPIDS]
    xaResource=LocalXAResourceImpl@458307ec[connectionListener=7cf06c5e
    connectionManager=180e08c1 warned=false currentXid=null
    productName=PostgreSQL productVersion=9.5.14 jndiName=java:/OAPIDS]
    txSync=null]</p>
  </blockquote>
  
  <p>Is it signal that the datasource under big load or App server bug, fixed in later versions?</p>
  
  <p>Our App server is Wildfly 12</p>
  
  <p>DB is Postgres</p>
  
  <p>And some of database queries do not work at the same time with errors "Unable to acquire connection"</p>
  
  <pre><code>Caused by: org.hibernate.exception.GenericJDBCException: Unable to acquire JDBC Connection
      at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:47)
      at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:111)
      at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:97)
      at org.hibernate.resource.jdbc.internal.LogicalConnectionManagedImpl.acquireConnectionIfNeeded(LogicalConnectionManagedImpl.java:87)
      at org.hibernate.resource.jdbc.internal.LogicalConnectionManagedImpl.getPhysicalConnection(LogicalConnectionManagedImpl.java:109)
      at org.hibernate.engine.jdbc.internal.StatementPreparerImpl.connection(StatementPreparerImpl.java:47)
      at org.hibernate.engine.jdbc.internal.StatementPreparerImpl$5.doPrepare(StatementPreparerImpl.java:146)
      at org.hibernate.engine.jdbc.internal.StatementPreparerImpl$StatementPreparationTemplate.prepareStatement(StatementPreparerImpl.java:172)
      at org.hibernate.engine.jdbc.internal.StatementPreparerImpl.prepareQueryStatement(StatementPreparerImpl.java:148)
      at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1934)
      at org.hibernate.loader.Loader.executeQueryStatement(Loader.java:1903)
      at org.hibernate.loader.Loader.executeQueryStatement(Loader.java:1881)
      at org.hibernate.loader.Loader.doQuery(Loader.java:925)
      at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:342)
      at org.hibernate.loader.Loader.doList(Loader.java:2622)
      at org.hibernate.loader.Loader.doList(Loader.java:2605)
      at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2434)
      at org.hibernate.loader.Loader.list(Loader.java:2429)
      at org.hibernate.loader.custom.CustomLoader.list(CustomLoader.java:336)
      at org.hibernate.internal.SessionImpl.listCustomQuery(SessionImpl.java:1980)
      at org.hibernate.internal.AbstractSessionImpl.list(AbstractSessionImpl.java:322)
      at org.hibernate.internal.SQLQueryImpl.list(SQLQueryImpl.java:125)
      at org.hibernate.jpa.internal.QueryImpl.list(QueryImpl.java:606)
      at org.hibernate.jpa.internal.QueryImpl.getResultList(QueryImpl.java:483)
      ... 81 more
  Caused by: java.sql.SQLException: javax.resource.ResourceException: IJ000457: Unchecked throwable in managedConnectionReconnected() cl=org.jboss.jca.core.connectionmanager.listener.TxConnectionListener@43697861[state=NORMAL managed connection=org.jboss.jca.adapters.jdbc.local.LocalManagedConnection@58a27593 connection handles=0 lastReturned=1589649243598 lastValidated=1589648924489 lastCheckedOut=1589649243527 trackByTx=false pool=org.jboss.jca.core.connectionmanager.pool.strategy.OnePool@5755db92 mcp=SemaphoreConcurrentLinkedQueueManagedConnectionPool@7c0f33f2[pool=OAPIDS] xaResource=LocalXAResourceImpl@2e150b3f[connectionListener=43697861 connectionManager=180e08c1 warned=false currentXid=null productName=PostgreSQL productVersion=9.5.14 jndiName=java:/OAPIDS] txSync=null]
      at org.jboss.jca.adapters.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:146)
      at org.jboss.as.connector.subsystems.datasources.WildFlyDataSource.getConnection(WildFlyDataSource.java:64)
      at org.hibernate.engine.jdbc.connections.internal.DatasourceConnectionProviderImpl.getConnection(DatasourceConnectionProviderImpl.java:122)
      at org.hibernate.internal.AbstractSessionImpl$NonContextualJdbcConnectionAccess.obtainConnection(AbstractSessionImpl.java:386)
      at org.hibernate.resource.jdbc.internal.LogicalConnectionManagedImpl.acquireConnectionIfNeeded(LogicalConnectionManagedImpl.java:84)
      ... 101 more
  Caused by: javax.resource.ResourceException: IJ000457: Unchecked throwable in managedConnectionReconnected() cl=org.jboss.jca.core.connectionmanager.listener.TxConnectionListener@43697861[state=NORMAL managed connection=org.jboss.jca.adapters.jdbc.local.LocalManagedConnection@58a27593 connection handles=0 lastReturned=1589649243598 lastValidated=1589648924489 lastCheckedOut=1589649243527 trackByTx=false pool=org.jboss.jca.core.connectionmanager.pool.strategy.OnePool@5755db92 mcp=SemaphoreConcurrentLinkedQueueManagedConnectionPool@7c0f33f2[pool=OAPIDS] xaResource=LocalXAResourceImpl@2e150b3f[connectionListener=43697861 connectionManager=180e08c1 warned=false currentXid=null productName=PostgreSQL productVersion=9.5.14 jndiName=java:/OAPIDS] txSync=null]
      at org.jboss.jca.core.connectionmanager.AbstractConnectionManager.reconnectManagedConnection(AbstractConnectionManager.java:975)
      at org.jboss.jca.core.connectionmanager.AbstractConnectionManager.allocateConnection(AbstractConnectionManager.java:792)
      at org.jboss.jca.adapters.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:138)
      ... 105 more
  Caused by: javax.resource.ResourceException: IJ000461: Could not enlist in transaction on entering meta-aware object
      at org.jboss.jca.core.connectionmanager.tx.TxConnectionManagerImpl.managedConnectionReconnected(TxConnectionManagerImpl.java:561)
      at org.jboss.jca.core.connectionmanager.AbstractConnectionManager.reconnectManagedConnection(AbstractConnectionManager.java:970)
      ... 107 more
  Caused by: java.lang.IllegalStateException: Transaction Local transaction (delegate=TransactionImple &lt; ac, BasicAction: 0:ffffc0a8cf9f:1902a63b:5ebfdd0d:c3e3c status: ActionStatus.ABORTED &gt;, owner=Local transaction context for provider JBoss JTA transaction provider) is not active STATUS_ROLLEDBACK
      at org.jboss.jca.core.connectionmanager.listener.TxConnectionListener.enlist(TxConnectionListener.java:296)
      at org.jboss.jca.core.connectionmanager.tx.TxConnectionManagerImpl.managedConnectionReconnected(TxConnectionManagerImpl.java:554)
      ... 108 more
  </code></pre>