[keycloak-user] Keycloak unable to open JDBC connection

Edgar Vonk - Info.nl Edgar at info.nl
Thu Jul 21 08:34:10 EDT 2016


We also recently had an issue where Keycloak stopped working because it could no longer get any (Oracle) DB connections from the connection pool. This was not after a restart but just during normal operation.

We had configured the DB connection pool to use background-validation and this has worked fine until recently.

As mentioned in http://stackoverflow.com/questions/28707650/wildfly-and-auto-reconnect-to-the-database (linked from: https://issues.jboss.org/browse/KEYCLOAK-3204) the issue seems to be that starting from Wildfly 10 (?) this background validation no longer works due to a bug in Wildfly. As suggested there we have now configured the connection pool with validate-on-match set to true and we hope this will resolve the issue.

We only started to see this issue after upgrading to Keycloak 2.0.0 and I think that is where Wildfly was upgraded to version 10? Or maybe it was just bad luck..

The stack trace we had:


Caused by: java.sql.SQLException: javax.resource.ResourceException: IJ000453: Unable to get managed connection for java:jboss/datasources/KeycloakDS
	at org.jboss.jca.adapters.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:146)
	at org.jboss.as.connector.subsystems.datasources.WildFlyDataSource.getConnection(WildFlyDataSource.java:66)
	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:87)
	... 71 more
Caused by: javax.resource.ResourceException: IJ000453: Unable to get managed connection for java:jboss/datasources/KeycloakDS
	at org.jboss.jca.core.connectionmanager.AbstractConnectionManager.getManagedConnection(AbstractConnectionManager.java:656)
	at org.jboss.jca.core.connectionmanager.tx.TxConnectionManagerImpl.getManagedConnection(TxConnectionManagerImpl.java:429)
	at org.jboss.jca.core.connectionmanager.AbstractConnectionManager.allocateConnection(AbstractConnectionManager.java:747)
	at org.jboss.jca.adapters.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:138)
	... 75 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.SemaphoreConcurrentLinkedDequeManagedConnectionPool.getConnection(SemaphoreConcurrentLinkedDequeManagedConnectionPool.java:564)
	at org.jboss.jca.core.connectionmanager.pool.AbstractPool.getSimpleConnection(AbstractPool.java:626)
	at org.jboss.jca.core.connectionmanager.pool.AbstractPool.getConnection(AbstractPool.java:598)
	at org.jboss.jca.core.connectionmanager.AbstractConnectionManager.getManagedConnection(AbstractConnectionManager.java:590)
	... 78 more 


More information about the keycloak-user mailing list