title: No managed connections available within configured blocking timeout (30000 [ms])
body: <p>I use WildFly V 10.1.0 with Mysql Database.</p>
  
  <p>I have defined max pool size as 100 in the datasource configuration in standalone.xml</p>
  
  <p>But Still I'm getting following exception[1];</p>
  
  <p>I do not see any network issue. What other settings I need to add?</p>
  
  <p><strong>My persistence.xml</strong></p>
  
  <pre><code>&lt;persistence-unit name="adb-persistence-unit"
      transaction-type="JTA"&gt;
      &lt;description&gt;Forge Persistence Unit&lt;/description&gt;
      &lt;provider&gt;org.hibernate.ejb.HibernatePersistence&lt;/provider&gt;
      &lt;jta-data-source&gt;java:jboss/datasources/testDS&lt;/jta-data-source&gt;        
      &lt;shared-cache-mode&gt;ALL&lt;/shared-cache-mode&gt;
   &lt;property name="jboss.as.jpa.providerModule" value="org.hibernate:5.2"/&gt;
  
          &lt;property name="hibernate.c3p0.min_size" value="5" /&gt;   
     &lt;property name="hibernate.c3p0.max_size" value="500" /&gt;  
  &lt;property name="hibernate.c3p0.timeout" value="1800" /&gt;     
  &lt;property name="hibernate.c3p0.max_statements" value="100" /&gt; 
      &lt;property name="hibernate.c3p0.idle_test_period" value="3000" /&gt; 
      &lt;property name="hibernate.c3p0.acquire_increment" value="5" /&gt;  
  &lt;property name="hibernate.c3p0.validate" value="false" /&gt;
  </code></pre>
  
  <p>I open session like;</p>
  
  <pre><code>    @PersistenceContext
          protected EntityManager entityManager;
          private Criteria criteria;
          private Session session;
  
     session = getEntityManager().unwrap(Session.class);
  </code></pre>
  
  <p>[1]</p>
  
  <pre><code>/20/2016 9:52:04 AMCaused by: java.sql.SQLException: javax.resource.ResourceException: IJ000453: Unable to get managed connection for java:jboss/datasources/testDS
  10/20/2016 9:52:04 AM   at org.jboss.jca.adapters.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:146)
  10/20/2016 9:52:04 AM   at org.jboss.as.connector.subsystems.datasources.WildFlyDataSource.getConnection(WildFlyDataSource.java:66)
  10/20/2016 9:52:04 AM   at org.hibernate.engine.jdbc.connections.internal.DatasourceConnectionProviderImpl.getConnection(DatasourceConnectionProviderImpl.java:122)
  10/20/2016 9:52:04 AM   at org.hibernate.internal.NonContextualJdbcConnectionAccess.obtainConnection(NonContextualJdbcConnectionAccess.java:35)
  10/20/2016 9:52:04 AM   at org.hibernate.resource.jdbc.internal.LogicalConnectionManagedImpl.acquireConnectionIfNeeded(LogicalConnectionManagedImpl.java:99)
  10/20/2016 9:52:04 AM   ... 225 more
  10/20/2016 9:52:04 AMCaused by: javax.resource.ResourceException: IJ000453: Unable to get managed connection for java:jboss/datasources/testDS
  10/20/2016 9:52:04 AM   at org.jboss.jca.core.connectionmanager.AbstractConnectionManager.getManagedConnection(AbstractConnectionManager.java:656)
  10/20/2016 9:52:04 AM   at org.jboss.jca.core.connectionmanager.tx.TxConnectionManagerImpl.getManagedConnection(TxConnectionManagerImpl.java:429)
  10/20/2016 9:52:04 AM   at org.jboss.jca.core.connectionmanager.AbstractConnectionManager.allocateConnection(AbstractConnectionManager.java:747)
  10/20/2016 9:52:04 AM   at org.jboss.jca.adapters.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:138)
  10/20/2016 9:52:04 AM   ... 229 more
  10/20/2016 9:52:04 AMCaused by: javax.resource.ResourceException: IJ000655: No managed connections available within configured blocking timeout (30000 [ms])
  10/20/2016 9:52:04 AM   at org.jboss.jca.core.connectionmanager.pool.mcp.SemaphoreConcurrentLinkedDequeManagedConnectionPool.getConnection(SemaphoreConcurrentLinkedDequeManagedConnectionPool.java:565)
  10/20/2016 9:52:04 AM   at org.jboss.jca.core.connectionmanager.pool.AbstractPool.getTransactionNewConnection(AbstractPool.java:699)
  10/20/2016 9:52:04 AM   at org.jboss.jca.core.connectionmanager.pool.AbstractPool.getConnection(AbstractPool.java:598)
  10/20/2016 9:52:04 AM   at org.jboss.jca.core.connectionmanager.AbstractConnectionManager.getManagedConnection(AbstractConnectionManager.java:590)
  10/20/2016 9:52:04 AM   ... 232 more
  10/20/
  </code></pre>
  
  <p><strong>Edit</strong></p>
  
  <p><strong>Datasource</strong></p>
  
  <pre><code>     &lt;datasources&gt;
              &lt;datasource jndi-name="java:jboss/datasources/testDS" pool-name="lobDS" enabled="true" use-java-context="true" use-ccm="true"&gt;
                  &lt;connection-url&gt;jdbc:mysql://${env.MYSQL_PORT_3306_TCP_ADDR:db.xx.com}:${env.MYSQL_PORT_3306_TCP_PORT:3306}/${env.MYSQL_DATABASE:testdb}?failOverReadOnly=false&amp;amp;maxReconnects=10&amp;amp;zeroDateTimeBehavior=convertToNull&amp;amp;autoReconnect=true&amp;amp;characterEncoding=UTF-8&amp;amp;characterSetResults=UTF-8&amp;amp;useUnicode=true&amp;amp;interactiveClient=true&amp;amp;sessionVariables=storage_engine=InnoDB&lt;/connection-url&gt;
                  &lt;driver&gt;mysql&lt;/driver&gt;
                  &lt;pool&gt;
                      &lt;flush-strategy&gt;IdleConnections&lt;/flush-strategy&gt;
   &lt;max-pool-size&gt;100&lt;/max-pool-size&gt;  
                  &lt;/pool&gt;
                  &lt;security&gt;
                      &lt;user-name&gt;${env.MYSQL_USER:admin}&lt;/user-name&gt;
                      &lt;password&gt;${env.MYSQL_PASSWORD:ss_password}&lt;/password&gt;
                  &lt;/security&gt;
                  &lt;validation&gt;
                      &lt;check-valid-connection-sql&gt;SELECT 1&lt;/check-valid-connection-sql&gt;
                      &lt;background-validation&gt;true&lt;/background-validation&gt;
                      &lt;background-validation-millis&gt;60000&lt;/background-validation-millis&gt;
                  &lt;/validation&gt;
              &lt;/datasource&gt;
  </code></pre>