spring-boot - 在 Heroku 上部署 JHipster 应用程序时,“无法将 '' 下的属性绑定到 com.zaxxer.hikari.HikariDataSource”
问题描述
我有一个 JHipster/Spring 整体站点,我正在尝试使用 JawsDB Maria 将其部署到 Heroku 免费测功机。我已将 JHipster 配置为在本地计算机上使用 Gradle 编译项目。
我收到此错误:
2020-11-27T00:13:51.332601+00:00 app[web.1]: 2020-11-27 00:13:51.329 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-27T00:13:51.335652+00:00 app[web.1]: 2020-11-27 00:13:51.335 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-27T00:13:51.360451+00:00 app[web.1]: 2020-11-27 00:13:51.360 ERROR 4 --- [ main] o.s.b.d.LoggingFailureAnalysisReporter :
2020-11-27T00:13:51.360453+00:00 app[web.1]:
2020-11-27T00:13:51.360454+00:00 app[web.1]: ***************************
2020-11-27T00:13:51.360454+00:00 app[web.1]: APPLICATION FAILED TO START
2020-11-27T00:13:51.360455+00:00 app[web.1]: ***************************
2020-11-27T00:13:51.360455+00:00 app[web.1]:
2020-11-27T00:13:51.360455+00:00 app[web.1]: Description:
2020-11-27T00:13:51.360456+00:00 app[web.1]:
2020-11-27T00:13:51.360457+00:00 app[web.1]: Failed to bind properties under '' to com.zaxxer.hikari.HikariDataSource:
2020-11-27T00:13:51.360458+00:00 app[web.1]:
2020-11-27T00:13:51.360458+00:00 app[web.1]: Property: driverclassname
2020-11-27T00:13:51.360459+00:00 app[web.1]: Value: com.mysql.cj.jdbc.Driver
2020-11-27T00:13:51.360460+00:00 app[web.1]: Origin: "driverClassName" from property source "source"
2020-11-27T00:13:51.360461+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-27T00:13:51.360462+00:00 app[web.1]:
2020-11-27T00:13:51.360462+00:00 app[web.1]: Action:
2020-11-27T00:13:51.360462+00:00 app[web.1]:
2020-11-27T00:13:51.360463+00:00 app[web.1]: Update your application's configuration
2020-11-27T00:13:51.360463+00:00 app[web.1]:
2020-11-27T00:13:51.487289+00:00 heroku[web.1]: Process exited with status 1
2020-11-27T00:13:52.528199+00:00 heroku[web.1]: State changed from starting to crashed
后端使用 Kotlin 编写并使用 MariaDB,而前端使用 Vue.js 编写。我已经配置了 JHipster 以在我的本地机器上编译源代码。
这是自动生成的application-heroku.yml
:
eureka:
instance:
hostname: financial-services-station.herokuapp.com
non-secure-port: 80
prefer-ip-address: false
client:
service-url:
defaultZone: ${JHIPSTER_REGISTRY_URL}/eureka/
spring:
datasource:
type: com.zaxxer.hikari.HikariDataSource
url: ${JDBC_DATABASE_URL}
username: ${JDBC_DATABASE_USERNAME}
password: ${JDBC_DATABASE_PASSWORD}
hikari:
maximumPoolSize: 8
我已经尝试com.oracle.ojdbc:ojdbc10:19.3.0.0
在我的 gradle 依赖项中包含它,但没有解决它。
解决方案
推荐阅读
- google-apps-script - 如果为假则无法返回下一步
- python - 是否有允许检查 24 小时制是否有效的库?
- windows - 如何在 windows 中使用 npm replace 命令而不是 windows replace.exe 命令
- android - 如何从 Android Uno 平台上的内容对话框中删除内容填充?
- c# - 使用 C# 无法查看范围报告上的步骤图表图
- c# - 具有不变名称“MySql.Data.MySqlClient”的 ADO.NET 提供程序不会注册 MySql.Data.Entity.EF6.dll
- html - 如何明确地与引导程序垂直和居中对齐?
- html - 如何在不使用 HTML 表格的情况下制作具有自动列宽的表格?
- sql - 如何约束 SQL 中的两列,使一列中的值只允许与另一列中的值结合出现?
- javascript - 通过URL构建列出可点击的项目并打开详细的星球页面