title: JDBC Unable to get managed connection
body: <p>I have been experiencing some problems with a Web App recently, I have a MDB (HornetQ) setup that consumes health messages from a number of remote nodes (standalone Java applications), as we have steadily increased the number of nodes that are reporting in we have start to have problems with the Web Application losing its database connection, checking the log files and upon receiving a message the following error is reported:</p>
  
  <pre><code>2014-04-23 06:38:37,094 ERROR [org.hibernate.util.JDBCExceptionReporter] (Thread-100 (group:HornetQ-client-global-threads-32102134)) Unable to get managed connection for webAppDatasource; - nested throwable: (javax.resource.ResourceException: Unable to get managed connection for webAppDatasource)
  </code></pre>
  
  <p>Once this happens our whole web application is unusable as the database does not allow anymore connections and I have to login to the JBoss Admin Console, pause the queue, clear the backlog and then restart PostgreSQL</p>
  
  <p>I initially thought that the application was taking too many connections and I added 3CP0 to pool them but this doesn't seem to have helped (using the default settings), I have also moved our database onto a separate server to help with any performance bottlenecks and have added the 'autoReconnect' and 'check-valid-connection-sql' attributes to the datasource config as follows:</p>
  
  <pre><code>&lt;datasources&gt;
      &lt;local-tx-datasource&gt;
          &lt;jndi-name&gt;webAppDatasource&lt;/jndi-name&gt;
          &lt;connection-url&gt;jdbc:postgresql://10.123.123.23:5432/MainDb&lt;/connection-url&gt;
          &lt;driver-class&gt;org.postgresql.Driver&lt;/driver-class&gt;
          &lt;autoReconnect&gt;true&lt;/autoReconnect&gt;
          &lt;check-valid-connection-sql&gt;select count(*) from admin_users&lt;/check-valid-connection-sql&gt;
          &lt;failOverReadOnly&gt;false&lt;/failOverReadOnly&gt;
          &lt;maxReconnects&gt;50&lt;/maxReconnects&gt;
          &lt;initialTimeout&gt;15&lt;/initialTimeout&gt;
          &lt;user-name&gt;jboss&lt;/user-name&gt;
          &lt;password&gt;*****&lt;/password&gt;
      &lt;/local-tx-datasource&gt;
  &lt;/datasources&gt; 
  </code></pre>
  
  <p>On average the application seems to use about 4 / 5 connections which doesnt seem too excessive.</p>
  
  <p>The MDB itself is quite simple and parses the message, performs some checks against the database and persists the contents to a few different tables, there are about 60 nodes producing 1 message every 120sec so its possible that the application/database is getting overwhelmed at certain points</p>
  
  <p>So my question is, can anyone suggest why the datasources would just lose their connections and are there any steps I can take to prevent this from happening?</p>
  
  <p>Thanks</p>
  
  <p>(I am using the postgresql-9.0-802.jdbc4 driver, PostgreSQL 9.0, Hibernate 3.6, JBoss AS 6)</p>
  
  <p>Update: Stacktrace below, </p>
  
  <pre><code>2014-04-23 06:48:39,886 ERROR [org.quartz.core.JobRunShell] (JBossQuartzScheduler_Worker-7) Job default.job.10.1398215092090 threw an unhandled Exception: : javax.ejb.EJBTransactionRolledbackException: org.hibernate.exception.GenericJDBCException: Cannot open connection
          at $Proxy328.findById(Unknown Source)
          at sun.reflect.GeneratedMethodAccessor603.invoke(Unknown Source)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
          at java.lang.reflect.Method.invoke(Method.java:597)
          at org.jboss.seam.util.Reflections.invoke(Reflections.java:22)
          at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:32)
          at org.jboss.seam.intercept.ClientSideInterceptor$1.proceed(ClientSideInterceptor.java:76)
          at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56)
          at org.jboss.seam.security.SecurityInterceptor.aroundInvoke(SecurityInterceptor.java:163)
          at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
          at org.jboss.seam.ejb.RemoveInterceptor.aroundInvoke(RemoveInterceptor.java:43)
          at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
          at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:107)
          at org.jboss.seam.intercept.ClientSideInterceptor.invoke(ClientSideInterceptor.java:54)
          at org.javassist.tmp.java.lang.Object_$$_javassist_seam_9.findById(Object_$$_javassist_seam_9.java)
          at uk.co.webapp.actions.scheduled.ScheduledActionsBean$7.execute(ScheduledActionsBean.java:254)
          at org.jboss.seam.security.Identity.runAs(Identity.java:743)
          at org.jboss.seam.security.RunAsOperation.run(RunAsOperation.java:75)
          at uk.co.webapp.actions.scheduled.ScheduledActionsBean.ustdCompleter(ScheduledActionsBean.java:348)
          at sun.reflect.GeneratedMethodAccessor1836.invoke(Unknown Source)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
          at java.lang.reflect.Method.invoke(Method.java:597)
          at org.jboss.aop.joinpoint.MethodInvocation.invokeTarget(MethodInvocation.java:122)
          at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:111)
          at org.jboss.ejb3.interceptors.container.ContainerMethodInvocationWrapper.invokeNext(ContainerMethodInvocationWrapper.java:72)
          at org.jboss.ejb3.interceptors.aop.InvocationContextInterceptor$InvocationContext.proceed(InvocationContextInterceptor.java:127)
          at org.jboss.seam.intercept.EJBInvocationContext.proceed(EJBInvocationContext.java:44)
          at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56)
          at org.jboss.seam.transaction.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:28)
          at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
          at org.jboss.seam.core.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:77)
          at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
          at org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:44)
          at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
          at org.jboss.seam.persistence.EntityManagerProxyInterceptor.aroundInvoke(EntityManagerProxyInterceptor.java:29)
          at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
          at org.jboss.seam.persistence.HibernateSessionProxyInterceptor.aroundInvoke(HibernateSessionProxyInterceptor.java:30)
          at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
          at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:107)
          at org.jboss.seam.intercept.SessionBeanInterceptor.aroundInvoke(SessionBeanInterceptor.java:50)
          at sun.reflect.GeneratedMethodAccessor554.invoke(Unknown Source)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
          at java.lang.reflect.Method.invoke(Method.java:597)
          at org.jboss.ejb3.interceptors.aop.EJB3InterceptorInterceptor.invoke(EJB3InterceptorInterceptor.java:80)
          at org.jboss.ejb3.interceptors.aop.EJB3InterceptorInterceptor.invoke(EJB3InterceptorInterceptor.java:71)
          at org.jboss.ejb3.interceptors.container.ContainerMethodInvocationWrapper.invokeNext(ContainerMethodInvocationWrapper.java:62)
          at org.jboss.ejb3.interceptors.aop.InterceptorSequencer.invoke(InterceptorSequencer.java:76)
          at org.jboss.ejb3.interceptors.aop.InterceptorSequencer.aroundInvoke(InterceptorSequencer.java:62)
          at sun.reflect.GeneratedMethodAccessor455.invoke(Unknown Source)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
          at java.lang.reflect.Method.invoke(Method.java:597)
          at org.jboss.aop.advice.PerJoinpointAdvice.invoke(PerJoinpointAdvice.java:174)
          at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
          at org.jboss.ejb3.interceptors.aop.InvocationContextInterceptor.fillMethod(InvocationContextInterceptor.java:74)
          at org.jboss.aop.advice.org.jboss.ejb3.interceptors.aop.InvocationContextInterceptor_z_fillMethod_12864763.invoke(InvocationContextInterceptor_z_fillMethod_12864763.java)
          at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
          at org.jboss.ejb3.interceptors.aop.InvocationContextInterceptor.setup(InvocationContextInterceptor.java:90)
          at org.jboss.aop.advice.org.jboss.ejb3.interceptors.aop.InvocationContextInterceptor_z_setup_12864763.invoke(InvocationContextInterceptor_z_setup_12864763.java)
          at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
          at org.jboss.ejb3.async.impl.interceptor.AsynchronousServerInterceptor.invoke(AsynchronousServerInterceptor.java:128)
          at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
          at org.jboss.ejb3.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:62)
          at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
          at org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:56)
          at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
          at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:47)
          at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
          at org.jboss.ejb3.tx.NullInterceptor.invoke(NullInterceptor.java:42)
          at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
          at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:68)
          at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
          at org.jboss.ejb3.core.context.SessionInvocationContextAdapter.proceed(SessionInvocationContextAdapter.java:95)
          at org.jboss.ejb3.tx2.impl.CMTTxInterceptor.invokeInCallerTx(CMTTxInterceptor.java:223)
          at $Proxy304.ustdCompleter(Unknown Source)
          at sun.reflect.GeneratedMethodAccessor1835.invoke(Unknown Source)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
          at java.lang.reflect.Method.invoke(Method.java:597)
          at org.jboss.seam.util.Reflections.invoke(Reflections.java:22)
          at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:32)
          at org.jboss.seam.intercept.ClientSideInterceptor$1.proceed(ClientSideInterceptor.java:76)
          at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56)
          at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:107)
          at org.jboss.seam.intercept.ClientSideInterceptor.invoke(ClientSideInterceptor.java:54)
          at org.javassist.tmp.java.lang.Object_$$_javassist_seam_20.ustdCompleter(Object_$$_javassist_seam_20.java)
          at uk.co.webapp.actions.scheduled.UstdCompleter.execute(UstdCompleter.java:38)
          at sun.reflect.GeneratedMethodAccessor1844.invoke(Unknown Source)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
          at java.lang.reflect.Method.invoke(Method.java:597)
          at org.jboss.aop.joinpoint.MethodInvocation.invokeTarget(MethodInvocation.java:122)
          at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:111)
          at org.jboss.ejb3.interceptors.container.ContainerMethodInvocationWrapper.invokeNext(ContainerMethodInvocationWrapper.java:72)
          at org.jboss.ejb3.interceptors.aop.InvocationContextInterceptor$InvocationContext.proceed(InvocationContextInterceptor.java:127)
          at org.jboss.seam.intercept.EJBInvocationContext.proceed(EJBInvocationContext.java:44)
          at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56)
          at org.jboss.seam.transaction.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:28)
          at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
          at org.jboss.seam.core.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:77)
          at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
          at org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:44)
          at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
          at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:118)
          at org.jboss.seam.intercept.SessionBeanInterceptor.aroundInvoke(SessionBeanInterceptor.java:50)
          at sun.reflect.GeneratedMethodAccessor554.invoke(Unknown Source)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
          at java.lang.reflect.Method.invoke(Method.java:597)
          at org.jboss.ejb3.interceptors.aop.EJB3InterceptorInterceptor.invoke(EJB3InterceptorInterceptor.java:80)
          at org.jboss.ejb3.interceptors.aop.EJB3InterceptorInterceptor.invoke(EJB3InterceptorInterceptor.java:71)
          at org.jboss.ejb3.interceptors.container.ContainerMethodInvocationWrapper.invokeNext(ContainerMethodInvocationWrapper.java:62)
          at org.jboss.ejb3.interceptors.aop.InterceptorSequencer.invoke(InterceptorSequencer.java:76)
          at org.jboss.ejb3.interceptors.aop.InterceptorSequencer.aroundInvoke(InterceptorSequencer.java:62)
          at sun.reflect.GeneratedMethodAccessor455.invoke(Unknown Source)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
          at java.lang.reflect.Method.invoke(Method.java:597)
          at org.jboss.aop.advice.PerJoinpointAdvice.invoke(PerJoinpointAdvice.java:174)
          at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
          at org.jboss.ejb3.interceptors.aop.InvocationContextInterceptor.fillMethod(InvocationContextInterceptor.java:74)
          at org.jboss.aop.advice.org.jboss.ejb3.interceptors.aop.InvocationContextInterceptor_z_fillMethod_12864763.invoke(InvocationContextInterceptor_z_fillMethod_12864763.java)
          at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
          at org.jboss.ejb3.interceptors.aop.InvocationContextInterceptor.setup(InvocationContextInterceptor.java:90)
          at org.jboss.aop.advice.org.jboss.ejb3.interceptors.aop.InvocationContextInterceptor_z_setup_12864763.invoke(InvocationContextInterceptor_z_setup_12864763.java)
          at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
          at org.jboss.ejb3.async.impl.interceptor.AsynchronousServerInterceptor.invoke(AsynchronousServerInterceptor.java:110)
          at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
          at org.jboss.ejb3.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:62)
          at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
          at org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:56)
          at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
          at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:47)
          at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
          at org.jboss.ejb3.tx.NullInterceptor.invoke(NullInterceptor.java:42)
          at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
          at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:68)
          at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
          at org.jboss.ejb3.core.context.InvocationContextAdapter.proceed(InvocationContextAdapter.java:70)
          at org.jboss.ejb3.tx2.impl.CMTTxInterceptor.invokeInCallerTx(CMTTxInterceptor.java:223)
          at org.jboss.ejb3.tx2.impl.CMTTxInterceptor.required(CMTTxInterceptor.java:353)
          at org.jboss.ejb3.tx2.impl.CMTTxInterceptor.invoke(CMTTxInterceptor.java:209)
          at org.jboss.ejb3.tx2.aop.CMTTxInterceptorWrapper.invoke(CMTTxInterceptorWrapper.java:52)
          at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
          at org.jboss.ejb3.tx.NullInterceptor.invoke(NullInterceptor.java:42)
          at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
          at org.jboss.ejb3.security.Ejb3AuthenticationInterceptorv2.invoke(Ejb3AuthenticationInterceptorv2.java:79)
          at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
          at org.jboss.ejb3.BlockContainerShutdownInterceptor.invoke(BlockContainerShutdownInterceptor.java:67)
          at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
          at org.jboss.ejb3.core.context.CurrentInvocationContextInterceptor.invoke(CurrentInvocationContextInterceptor.java:47)
          at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
          at org.jboss.aspects.currentinvocation.CurrentInvocationInterceptor.invoke(CurrentInvocationInterceptor.java:67)
          at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
          at org.jboss.ejb3.interceptor.EJB3TCCLInterceptor.invoke(EJB3TCCLInterceptor.java:86)
          at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
          at org.jboss.ejb3.mdb.MessagingContainer.localInvoke(MessagingContainer.java:306)
          at org.jboss.ejb3.mdb.inflow.MessageInflowLocalProxy.delivery(MessageInflowLocalProxy.java:299)
          at org.jboss.ejb3.mdb.inflow.MessageInflowLocalProxy.invoke(MessageInflowLocalProxy.java:152)
          at $Proxy257.execute(Unknown Source)
          at org.jboss.resource.adapter.quartz.inflow.QuartzJob.execute(QuartzJob.java:57)
          at org.quartz.core.JobRunShell.run(JobRunShell.java:216)
          at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:549)
  Caused by: javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: Cannot open connection
          at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1214)
          at org.hibernate.ejb.AbstractEntityManagerImpl.find(AbstractEntityManagerImpl.java:635)
          at org.hibernate.ejb.AbstractEntityManagerImpl.find(AbstractEntityManagerImpl.java:589)
          at sun.reflect.GeneratedMethodAccessor605.invoke(Unknown Source)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
          at java.lang.reflect.Method.invoke(Method.java:597)
          at org.jboss.seam.persistence.EntityManagerInvocationHandler.invoke(EntityManagerInvocationHandler.java:46)
          at $Proxy371.find(Unknown Source)
          at uk.co.webapp.dao.generic.GenericDAOBean.findById(GenericDAOBean.java:93)
          at sun.reflect.GeneratedMethodAccessor604.invoke(Unknown Source)
          ... 222 more
  Caused by: org.hibernate.exception.GenericJDBCException: Cannot open connection
          at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:140)
          at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:128)
          at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
          at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:52)
          at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:449)
          at org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:167)
          at org.hibernate.jdbc.AbstractBatcher.prepareQueryStatement(AbstractBatcher.java:161)
          at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1700)
          at org.hibernate.loader.Loader.doQuery(Loader.java:801)
          at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:274)
          at org.hibernate.loader.Loader.loadEntity(Loader.java:2037)
          at org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:86)
          at org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:76)
          at org.hibernate.persister.entity.AbstractEntityPersister.load(AbstractEntityPersister.java:3268)
          at org.hibernate.event.def.DefaultLoadEventListener.loadFromDatasource(DefaultLoadEventListener.java:496)
          at org.hibernate.event.def.DefaultLoadEventListener.doLoad(DefaultLoadEventListener.java:477)
          at org.hibernate.event.def.DefaultLoadEventListener.load(DefaultLoadEventListener.java:227)
          at org.hibernate.event.def.DefaultLoadEventListener.proxyOrLoad(DefaultLoadEventListener.java:285)
          at org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:152)
          at org.hibernate.impl.SessionImpl.fireLoad(SessionImpl.java:1090)
          at org.hibernate.impl.SessionImpl.get(SessionImpl.java:1005)
          at org.hibernate.impl.SessionImpl.get(SessionImpl.java:998)
          at org.hibernate.ejb.AbstractEntityManagerImpl.find(AbstractEntityManagerImpl.java:614)
          ... 271 more
  Caused by: org.jboss.util.NestedSQLException: Unable to get managed connection for webAppDatasource; - nested throwable: (javax.resource.ResourceException: Unable to get managed connection for webAppDatasource)
  
  
          at org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:95)
          at org.hibernate.ejb.connection.InjectedDataSourceConnectionProvider.getConnection(InjectedDataSourceConnectionProvider.java:71)
          at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:446)
          ... 289 more
  Caused by: javax.resource.ResourceException: Unable to get managed connection for webAppDatasource
          at org.jboss.resource.connectionmanager.BaseConnectionManager2.getManagedConnection(BaseConnectionManager2.java:441)
          at org.jboss.resource.connectionmanager.TxConnectionManager.getManagedConnection(TxConnectionManager.java:414)
          at org.jboss.resource.connectionmanager.BaseConnectionManager2.allocateConnection(BaseConnectionManager2.java:496)
          at org.jboss.resource.connectionmanager.BaseConnectionManager2$ConnectionManagerProxy.allocateConnection(BaseConnectionManager2.java:941)
          at org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:89)
          ... 291 more
  Caused by: javax.resource.ResourceException: No ManagedConnections available within configured blocking timeout ( 30000 [ms] )
          at org.jboss.resource.connectionmanager.InternalManagedConnectionPool.getConnection(InternalManagedConnectionPool.java:310)
          at org.jboss.resource.connectionmanager.JBossManagedConnectionPool$BasePool.getConnection(JBossManagedConnectionPool.java:747)
          at org.jboss.resource.connectionmanager.BaseConnectionManager2.getManagedConnection(BaseConnectionManager2.java:403)
          ... 295 more
  </code></pre>