title: Boot timeout when deploying Spring Boot application with JPA to Heroku
body: <p>I have a Spring Boot 1.5.1 application that I'm deploying with heroku-maven-plugin:</p>
  
  <pre><code>&lt;configuration&gt;
      &lt;appName&gt;${heroku.appName}&lt;/appName&gt;
      &lt;includeTarget&gt;false&lt;/includeTarget&gt;
      &lt;includes&gt;
          &lt;include&gt;${basedir}/${heroku.fullArtifactName}&lt;/include&gt;
      &lt;/includes&gt;
      &lt;processTypes&gt;
          &lt;web&gt;java $JAVA_OPTS -Dserver.port=$PORT -jar ${heroku.fullArtifactName}&lt;/web&gt;
      &lt;/processTypes&gt;
  &lt;/configuration&gt;
  </code></pre>
  
  <p>I can see Heroku filling in the port from logs:</p>
  
  <pre><code>2018-03-18T18:16:25.966746+00:00 heroku[web.1]: Starting process with command `java $JAVA_OPTS -Dserver.port=42658 -jar target/be-0.0.1-SNAPSHOT.jar
  </code></pre>
  
  <p>Initializing the application concludes with an error like seen in the following logs:</p>
  
  <pre><code>2018-03-18 18:18:26.046 DEBUG 4 --- [           main] o.a.tomcat.jdbc.pool.PooledConnection    : Instantiating driver using class: com.mysql.jdbc.Driver [url=jdbc:mysql://app/db?autoReconnect=true&amp;useSSL=false]
  2018-03-18 18:18:26.048 DEBUG 4 --- [           main] o.a.tomcat.jdbc.pool.ClassLoaderUtil     : Attempting to load class[com.mysql.jdbc.Driver] from org.springframework.boot.loader.LaunchedURLClassLoader@72ea2f77
  2018-03-18T18:19:32.196190+00:00 heroku[web.1]: Error R10 (Boot timeout) -&gt; Web process failed to bind to $PORT within 90 seconds of launch
  </code></pre>
  
  <p>Things work in my local environment (running through Intellij IDEA), logs for contrast:</p>
  
  <pre><code>2018-03-18 20:31:10.284 DEBUG --- o.s.jdbc.datasource.DataSourceUtils      : Fetching JDBC Connection from DataSource
  2018-03-18 20:31:10.289 DEBUG --- o.a.tomcat.jdbc.pool.PooledConnection    : Instantiating driver using class: com.mysql.jdbc.Driver [url=jdbc:mysql://url/db?autoReconnect=true&amp;useSSL=false]
  2018-03-18 20:31:10.290 DEBUG --- o.a.tomcat.jdbc.pool.ClassLoaderUtil     : Attempting to load class[com.mysql.jdbc.Driver] from sun.misc.Launcher$AppClassLoader@14dad5dc
  2018-03-18 20:31:11.900 DEBUG --- o.a.tomcat.jdbc.pool.PooledConnection    : Instantiating driver using class: com.mysql.jdbc.Driver [url=jdbc:mysql://url/db?autoReconnect=true&amp;useSSL=false]
  2018-03-18 20:31:11.900 DEBUG --- o.a.tomcat.jdbc.pool.ClassLoaderUtil     : Attempting to load class[com.mysql.jdbc.Driver] from sun.misc.Launcher$AppClassLoader@14dad5dc
  2018-03-18 20:31:13.257 DEBUG --- o.a.tomcat.jdbc.pool.PooledConnection    : Instantiating driver using class: com.mysql.jdbc.Driver [url=jdbc:mysql://url/db?autoReconnect=true&amp;useSSL=false]
  2018-03-18 20:31:13.257 DEBUG --- o.a.tomcat.jdbc.pool.ClassLoaderUtil     : Attempting to load class[com.mysql.jdbc.Driver] from sun.misc.Launcher$AppClassLoader@14dad5dc
  2018-03-18 20:31:14.633 DEBUG --- o.a.tomcat.jdbc.pool.PooledConnection    : Instantiating driver using class: com.mysql.jdbc.Driver [url=jdbc:mysql://url/db?autoReconnect=true&amp;useSSL=false]
  2018-03-18 20:31:14.634 DEBUG --- o.a.tomcat.jdbc.pool.ClassLoaderUtil     : Attempting to load class[com.mysql.jdbc.Driver] from sun.misc.Launcher$AppClassLoader@14dad5dc
  2018-03-18 20:31:15.991 DEBUG --- o.a.tomcat.jdbc.pool.PooledConnection    : Instantiating driver using class: com.mysql.jdbc.Driver [url=jdbc:mysql://url/db?autoReconnect=true&amp;useSSL=false]
  2018-03-18 20:31:15.991 DEBUG --- o.a.tomcat.jdbc.pool.ClassLoaderUtil     : Attempting to load class[com.mysql.jdbc.Driver] from sun.misc.Launcher$AppClassLoader@14dad5dc
  2018-03-18 20:31:17.344 DEBUG --- o.a.tomcat.jdbc.pool.PooledConnection    : Instantiating driver using class: com.mysql.jdbc.Driver [url=jdbc:mysql://url/db?autoReconnect=true&amp;useSSL=false]
  2018-03-18 20:31:17.345 DEBUG --- o.a.tomcat.jdbc.pool.ClassLoaderUtil     : Attempting to load class[com.mysql.jdbc.Driver] from sun.misc.Launcher$AppClassLoader@14dad5dc
  2018-03-18 20:31:18.692 DEBUG --- o.a.tomcat.jdbc.pool.PooledConnection    : Instantiating driver using class: com.mysql.jdbc.Driver [url=jdbc:mysql://url/db?autoReconnect=true&amp;useSSL=false]
  2018-03-18 20:31:18.693 DEBUG --- o.a.tomcat.jdbc.pool.ClassLoaderUtil     : Attempting to load class[com.mysql.jdbc.Driver] from sun.misc.Launcher$AppClassLoader@14dad5dc
  2018-03-18 20:31:20.068 DEBUG --- o.a.tomcat.jdbc.pool.PooledConnection    : Instantiating driver using class: com.mysql.jdbc.Driver [url=jdbc:mysql://url/db?autoReconnect=true&amp;useSSL=false]
  2018-03-18 20:31:20.069 DEBUG --- o.a.tomcat.jdbc.pool.ClassLoaderUtil     : Attempting to load class[com.mysql.jdbc.Driver] from sun.misc.Launcher$AppClassLoader@14dad5dc
  2018-03-18 20:31:21.388 DEBUG --- o.a.tomcat.jdbc.pool.PooledConnection    : Instantiating driver using class: com.mysql.jdbc.Driver [url=jdbc:mysql://url/db?autoReconnect=true&amp;useSSL=false]
  2018-03-18 20:31:21.388 DEBUG --- o.a.tomcat.jdbc.pool.ClassLoaderUtil     : Attempting to load class[com.mysql.jdbc.Driver] from sun.misc.Launcher$AppClassLoader@14dad5dc
  2018-03-18 20:31:22.751 DEBUG --- o.a.tomcat.jdbc.pool.PooledConnection    : Instantiating driver using class: com.mysql.jdbc.Driver [url=jdbc:mysql://url/db?autoReconnect=true&amp;useSSL=false]
  2018-03-18 20:31:22.752 DEBUG --- o.a.tomcat.jdbc.pool.ClassLoaderUtil     : Attempting to load class[com.mysql.jdbc.Driver] from sun.misc.Launcher$AppClassLoader@14dad5dc
  2018-03-18 20:31:24.113 DEBUG --- o.s.jdbc.datasource.DataSourceUtils      : Returning JDBC Connection to DataSource
  2018-03-18 20:31:24.168  INFO --- j.LocalContainerEntityManagerFactoryBean : Building JPA container EntityManagerFactory for persistence unit 'default'
  2018-03-18 20:31:24.179 DEBUG --- o.hibernate.jpa.internal.util.LogHelper  : PersistenceUnitInfo [
  </code></pre>
  
  <p>It does take some time to get the JDBC connection locally aswell with quite a few attempts to load the driver class, but the connection works fine.</p>
  
  <p>The configuration doesn't seem to differ really in local and Heroku and my debugging efforts haven't yielded much. Perhaps someone has an idea where should I direct my attention?</p>
  
  <p>EDIT:
  I'm using Amazon RDS for the DB and I'm thinking this might be an access issue (not sure why I can access the DB locally though...). Will check soon if that is the case.</p>