0

I'm trying to deploy a basic jhipster app with maven, angular and maria-db. Following the jhipster guide I've configured the application and deployed the locally compiled project. All the upload was ok but during the startup I received this issue:

2020-11-12T16:15:57.719036+00:00 app[web.1]: 2020-11-12 16:15:57.701  INFO 4 --- [           main] com.gate42.advpoint.AdvpointApp          : Starting AdvpointApp on cd5ce05d-5f60-4f27-a236-8c53eab442f9 with PID 4 (/app/target/advpoint-0.0.1-SNAPSHOT.jar started by u32323 in /app)
2020-11-12T16:15:57.735456+00:00 app[web.1]: 2020-11-12 16:15:57.728  INFO 4 --- [           main] com.gate42.advpoint.AdvpointApp          : The following profiles are active: prod,heroku
2020-11-12T16:16:05.779094+00:00 app[web.1]: 2020-11-12 16:16:05.776 ERROR 4 --- [           main] com.zaxxer.hikari.HikariConfig           : Failed to load driver class com.mysql.cj.jdbc.Driver from HikariConfig class classloader org.springframework.boot.loader.LaunchedURLClassLoader@6d00a15d
2020-11-12T16:16:05.781901+00:00 app[web.1]: 2020-11-12 16:16:05.781  WARN 4 --- [           main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is java.lang.RuntimeException: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'servletEndpointRegistrar' defined in class path resource [org/springframework/boot/actuate/autoconfigure/endpoint/web/ServletEndpointManagementContextConfiguration$WebMvcServletEndpointManagementContextConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.boot.actuate.endpoint.web.ServletEndpointRegistrar]: Factory method 'servletEndpointRegistrar' threw exception; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'healthEndpoint' defined in class path resource [org/springframework/boot/actuate/autoconfigure/health/HealthEndpointConfiguration.class]: Unsatisfied dependency expressed through method 'healthEndpoint' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'healthContributorRegistry' defined in class path resource [org/springframework/boot/actuate/autoconfigure/health/HealthEndpointConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.boot.actuate.health.HealthContributorRegistry]: Factory method 'healthContributorRegistry' threw exception; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.boot.actuate.autoconfigure.jdbc.DataSourceHealthContributorAutoConfiguration': Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Hikari.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.zaxxer.hikari.HikariDataSource]: Factory method 'dataSource' threw exception; nested exception is org.springframework.boot.context.properties.bind.BindException: Failed to bind properties under '' to com.zaxxer.hikari.HikariDataSource
2020-11-12T16:16:05.820063+00:00 app[web.1]: 2020-11-12 16:16:05.819 ERROR 4 --- [           main] o.s.b.d.LoggingFailureAnalysisReporter   :
2020-11-12T16:16:05.820065+00:00 app[web.1]:
2020-11-12T16:16:05.820066+00:00 app[web.1]: ***************************
2020-11-12T16:16:05.820066+00:00 app[web.1]: APPLICATION FAILED TO START
2020-11-12T16:16:05.820067+00:00 app[web.1]: ***************************
2020-11-12T16:16:05.820067+00:00 app[web.1]:
2020-11-12T16:16:05.820068+00:00 app[web.1]: Description:
2020-11-12T16:16:05.820068+00:00 app[web.1]:
2020-11-12T16:16:05.820069+00:00 app[web.1]: Failed to bind properties under '' to com.zaxxer.hikari.HikariDataSource:
2020-11-12T16:16:05.820069+00:00 app[web.1]:
2020-11-12T16:16:05.820070+00:00 app[web.1]: Property: driverclassname
2020-11-12T16:16:05.820071+00:00 app[web.1]: Value: com.mysql.cj.jdbc.Driver
2020-11-12T16:16:05.820072+00:00 app[web.1]: Origin: "driverClassName" from property source "source"
2020-11-12T16:16:05.820073+00:00 app[web.1]: Reason: Failed to load driver class com.mysql.cj.jdbc.Driver in either of HikariConfig class loader or Thread context classloader
2020-11-12T16:16:05.820073+00:00 app[web.1]:
2020-11-12T16:16:05.820073+00:00 app[web.1]: Action:
2020-11-12T16:16:05.820074+00:00 app[web.1]:
2020-11-12T16:16:05.820074+00:00 app[web.1]: Update your application's configuration
2020-11-12T16:16:05.820074+00:00 app[web.1]:
2020-11-12T16:16:05.957077+00:00 heroku[web.1]: Process exited with status 1
2020-11-12T16:16:06.003260+00:00 heroku[web.1]: State changed from starting to crashed
2020-11-12T16:42:37.888949+00:00 heroku[web.1]: State changed from crashed to starting

My heroku config is application-heroku.yml and was created automatically:

eureka:
  instance:
    hostname: advpoint.herokuapp.com
    non-secure-port: 80
    prefer-ip-address: false

spring:
  datasource:
    type: com.zaxxer.hikari.HikariDataSource
    url: ${JDBC_DATABASE_URL}
    username: ${JDBC_DATABASE_USERNAME}
    password: ${JDBC_DATABASE_PASSWORD}
    hikari:
      maximumPoolSize: 8

The db connection information were created by jawsdb-addon automatically. What can I do to solve this issue? Thanks to all that will answer.

Claudioc
  • 53
  • 1
  • 10

1 Answers1

1

To solve this issue I 've added this dependency in my pom file:

<dependency>
     <groupId>mysql</groupId>
     <artifactId>mysql-connector-java</artifactId>
</dependency>

I've supposed that during heroku configuration it was been added automatically. I don't know if this could be an issue or not, but in my opinion this could be done automatically by the jawsdb-addon when used.

Claudioc
  • 53
  • 1
  • 10
  • I'm not sure it's an issue with jawsdb-addon, it should not be responsible for managing your project dependencies; I'd rather think it's a bug in generator-jhipster or its heroku sub generator. Feel free to report it with more details on github.Also MySQL is being deprecated in Jhipster in favor of PostgreSQL – Gaël Marziou Nov 13 '20 at 11:29