Solving “No managed connections available within configured blocking timeout” error

This article discusses how to solve the error “No managed connections available within configured blocking timeout” which happens when you are not able to collect a Connection object from a WildFly Datasource.

Here is an example of this error, which can be found in the application server logs:

Caused by: javax.resource.ResourceException: IJ000453: Unable to get managed connection for java:jboss/datasource/PostgreDS
    at org.jboss.jca.core.connectionmanager.AbstractConnectionManager.getManagedConnection(
    at org.jboss.jca.core.connectionmanager.tx.TxConnectionManagerImpl.getManagedConnection(
    at org.jboss.jca.core.connectionmanager.AbstractConnectionManager.allocateConnection(
    at org.jboss.jca.adapters.jdbc.WrapperDataSource.getConnection(
    ... 51 more
Caused by: javax.resource.ResourceException: IJ000655: No managed connections available within configured blocking timeout (30000 [ms])
    at org.jboss.jca.core.connectionmanager.pool.mcp.SemaphoreArrayListManagedConnectionPool.getConnection(
    at org.jboss.jca.core.connectionmanager.pool.AbstractPool.getTransactionNewConnection(
    at org.jboss.jca.core.connectionmanager.pool.AbstractPool.getConnection(
    at org.jboss.jca.core.connectionmanager.AbstractConnectionManager.getManagedConnection(

    The datasource connection pool has not been tuned (e.g. max-pool-size and blocking-timeout-millis) correctly for the maximum load on the application.
    The application is leaking connections because it is not closing them and thereby returning them to the pool.
    Threads with connections to the database are hanging and holding on to the connections or slow performance (e.g. due to CPU or memory usage issues) may delay (otherwise rapid) return of connections by worker threads and lead to pool exhaustion.

There can be several reasons why you are not able to collect a Datasource object:

1) Your application is is not properly closing connections so there is a Connection leak which needs to be identified in your applications.


2) Your datasource might not be tuned for the required load.


  • Configure an appropriate value for max-pool-size and blocking-timeout-millis. Again, check the article WildFly Connection Pool configuration to find how to monitor the Datasource to find out the optimal values for max-pool-size and blocking-timeout-millis.

3) Your Database connection or SQL Statements are the bottleneck. Verify which statements are taking most of the time using your vendor’s SQL statements.

For example, MySQL provides a number of built-in tools to check the long running transaction. First of all, SHOW PROCESSLIST or SHOW FULL PROCESSLIST commands can expose the running queries in real-time.