title: Spring Boot + Flyway + AWS: Caused by: java.sql.SQLException: No suitable driver found
body: <p>I get this except in AWS Elastic Beanstalk, but the app works locally.</p>
  
  <pre><code>01-Aug-2018 07:44:54.815 SEVERE [localhost-startStop-1] org.apache.catalina.core.ContainerBase.addChildInternal ContainerBase.addChild: start: 
   org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[]]
  Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'flywayInitializer' defined in class path resource [org/springframework/boot/autoconfigure/flyway/FlywayAutoConfiguration$FlywayConfiguration.class]: Invocation of init method failed; nested exception is org.flywaydb.core.api.FlywayException: Unable to obtain Jdbc connection from DataSource
  Caused by: org.flywaydb.core.api.FlywayException: Unable to obtain Jdbc connection from DataSource
  Caused by: java.sql.SQLException: No suitable driver found for jdbc:mysql://d-use1-xx.xxxxxxxxxxx.us-east-1.rds.amazonaws.com:3306/xxxxxxxxxxx
  </code></pre>
  
  <p>The JDBC URL is specified correctly. I have this in <code>file.war/WEB-INF/classes/application.properties</code></p>
  
  <pre><code>spring.datasource.url = jdbc:mysql://d-use1-xx.xxxxxxxxxx.us-east-1.rds.amazonaws.com:3306/xxxxxxxxx
  spring.datasource.username = xxxx
  spring.datasource.password = xxxxxxxxx
  </code></pre>
  
  <p>I do have <code>\WEB-INF\lib\mysql-connector-java-5.1.46.jar</code> in the WAR file.</p>
  
  <p>I don't know if it matters but I recently added a JDBC TokenStore for Spring Security OAuth2 and added this in the main class.</p>
  
  <pre><code>@SpringBootApplication
  @MapperScan("com.xxxxxx.xxxxxx.mapper")
  public class XxxxxxxxxxxxApplication extends SpringBootServletInitializer {
  
      @Bean(name = "OAuth")
      @ConfigurationProperties(prefix="spring.datasource")
      public DataSource secondaryDataSource() {
          return DataSourceBuilder.create().build();
      }
  </code></pre>
  
  <p>I don't know if it matters (never did before) but there was an empty environment variable set</p>
  
  <blockquote>
    <p>01-Aug-2018 07:44:38.290 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -DJDBC_CONNECTION_STRING=</p>
  </blockquote>