title: Resuming an application from sleep causes 'Communications link failure'
body: <p>I have a CloudBees Run@cloud instance configured that runs fine, but after a while of inactivity it gets de-activated, and then seems the connection pool is not properly refreshed.</p>
  
  <p>When I return to the site, the first few requests time out with: </p>
  
  <pre><code>com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
  
  The last packet successfully received from the server was 4,746,680 milliseconds ago.  The last packet sent successfully to the server was 0 milliseconds ago.
      sun.reflect.GeneratedConstructorAccessor86.newInstance(Unknown Source)
      sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
      java.lang.reflect.Constructor.newInstance(Constructor.java:513)
      com.mysql.jdbc.Util.handleNewInstance(Util.java:407)
      com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1116)
      com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:3092)
      com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2978)
      com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3526)
      com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1989)
      com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2150)
      com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2620)
      com.mysql.jdbc.ConnectionImpl.setAutoCommit(ConnectionImpl.java:5022)
      org.apache.tomcat.dbcp.dbcp.DelegatingConnection.setAutoCommit(DelegatingConnection.java:371)
      org.apache.tomcat.dbcp.dbcp.PoolingDataSource$PoolGuardConnectionWrapper.setAutoCommit(PoolingDataSource.java:328)
      org.hibernate.transaction.JDBCTransaction.begin(JDBCTransaction.java:87)
      org.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:1473)
  </code></pre>
  
  <p>I am connecting via JNDI using a datasource configured in the cloudbees-web.xml file as such:</p>
  
  <pre><code>    &lt;resource name="jdbc/myapp" auth="Container" type="javax.sql.DataSource"&gt;
          &lt;param name="username" value="myuser" /&gt;
          &lt;param name="password" value="mypass" /&gt;
          &lt;param name="url" value="jdbc:cloudbees://myurl /&gt;
      &lt;/resource&gt;
  </code></pre>
  
  <p>Is there some configuration I'm missing, or is this a bug with the connection pool configuration in the server?</p>