title: SQLException: Timed out waiting for a free available connection
body: <p>I'm building an app in java with <code>Play Framework 2.0.4</code>. The app is deployed in <code>heroku</code> with cleardb database.</p>
  
  <p>Users keep getting this occasional error:</p>
  
  <pre><code>PlayException: Execution exception [[PersistenceException: java.sql.SQLException: Timed out waiting for a free available connection.]]
      at play.core.ActionInvoker$$anonfun$receive$1.apply(Invoker.scala:134)
      at play.core.ActionInvoker$$anonfun$receive$1.apply(Invoker.scala:115)
      at akka.actor.Actor$class.apply(Actor.scala:318)
      at play.core.ActionInvoker.apply(Invoker.scala:113)
      at akka.actor.ActorCell.invoke(ActorCell.scala:626)
      at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:197)
      at akka.dispatch.Mailbox.run(Mailbox.scala:179)
      at akka.dispatch.ForkJoinExecutorConfigurator$MailboxExecutionTask.exec(AbstractDispatcher.scala:516)
      at akka.jsr166y.ForkJoinTask.doExec(ForkJoinTask.java:259)
      at akka.jsr166y.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:975)
      at akka.jsr166y.ForkJoinPool.runWorker(ForkJoinPool.java:1479)
      at akka.jsr166y.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:104)
  Caused by: javax.persistence.PersistenceException: java.sql.SQLException: Timed out waiting for a free available connection.
      at com.avaje.ebeaninternal.server.transaction.TransactionManager.createQueryTransaction(TransactionManager.java:356)
      at com.avaje.ebeaninternal.server.core.DefaultServer.createQueryTransaction(DefaultServer.java:2021)
      at com.avaje.ebeaninternal.server.core.OrmQueryRequest.initTransIfRequired(OrmQueryRequest.java:241)
      at com.avaje.ebeaninternal.server.core.DefaultServer.findId(DefaultServer.java:1212)
      at com.avaje.ebeaninternal.server.core.DefaultServer.find(DefaultServer.java:1118)
      at com.avaje.ebeaninternal.server.core.DefaultServer.find(DefaultServer.java:1105)
      at play.db.ebean.Model$Finder.byId(Model.java:237)
  </code></pre>
  
  <p>Now is getting worse and sometimes all users get the same error every time until I restart the app in heroku.</p>
  
  <p>Any help or tips to debug it?</p>