【问题标题】:Can't build docker image for google app engine because exception is thrown during hikaripool initialization无法为谷歌应用引擎构建 docker 镜像,因为在 hikaripool 初始化期间抛出异常
【发布时间】:2021-09-07 02:55:07
【问题描述】:

“Etwas Ungewöhnliches ist passiert, das den Treiber fehlschlagen ließ. Bitte teilen Sie diesen Fehler mit.”

这意味着:

发生了一些不寻常的事情,导致驱动程序失败。请报告此错误。

我可以通过登录、验证和列出我现有的数据库,从本地计算机上的控制台连接到数据库。

首先我想可能是因为缺少凭据 json 文件。但我仍然得到错误(在这篇文章的结尾)

application.properties 文件

spring.profiles.active=postgresql
spring.sql.init.data-locations=classpath*:sql/data.sql
# JPA
spring.jpa.show-sql=true
spring.jpa.hibernate.ddl-auto=create
# JWT
jwt.secret=mart11
# Server
server.port=${port:8080}
# Postgre
spring.main.banner-mode=off
spring.sql.init.enabled=true
logging.level.org.springframework.data=INFO
logging.level.org.springframework.jdbc.core.JdbcTemplate=DEBUG

和 application-postgresql.properties 文件:

spring.cloud.gcp.sql.database-name=mart11
spring.cloud.gcp.sql.instance-connection-name=mart11-reservation:europe-west1:mart11
spring.cloud.gcp.credentials.location=cloud-key/mart11-reservation-bb76b28dff7c.json
java.lang.IllegalStateException: Failed to load ApplicationContext
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSourceScriptDatabaseInitializer' defined in class path resource [org/springframework/boot/autoconfigure/sql/init/DataSourceInitializationConfiguration.class]: Invocation of init method failed; nested exception is org.springframework.jdbc.datasource.init.UncategorizedScriptException: Failed to execute database script; nested exception is org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain JDBC Connection; nested exception is org.postgresql.util.PSQLException: Etwas Ungewöhnliches ist passiert, das den Treiber fehlschlagen ließ. Bitte teilen Sie diesen Fehler mit.
Caused by: org.springframework.jdbc.datasource.init.UncategorizedScriptException: Failed to execute database script; nested exception is org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain JDBC Connection; nested exception is org.postgresql.util.PSQLException: Etwas Ungewöhnliches ist passiert, das den Treiber fehlschlagen ließ. Bitte teilen Sie diesen Fehler mit.
Caused by: org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain JDBC Connection; nested exception is org.postgresql.util.PSQLException: Etwas Ungewöhnliches ist passiert, das den Treiber fehlschlagen ließ. Bitte teilen Sie diesen Fehler mit.
Caused by: org.postgresql.util.PSQLException: Etwas Ungewöhnliches ist passiert, das den Treiber fehlschlagen ließ. Bitte teilen Sie diesen Fehler mit.
Caused by: java.lang.RuntimeException: Unable to obtain credentials to communicate with the Cloud SQL API
Caused by: java.io.IOException: The Application Default Credentials are not available. They are available if running in Google Compute Engine. Otherwise, the environment variable GOOGLE_APPLICATION_CREDENTIALS must be defined pointing to a file defining the credentials. See https://developers.google.com/accounts/docs/application-default-credentials for more information.

【问题讨论】:

  • @llic 发表了答案,有用吗?

标签: java spring postgresql google-cloud-platform cloud


【解决方案1】:

由于错误显示默认凭据不可用,因此应用程序默认凭据 (ADC) 将难以验证服务帐户,因为未设置 GOOGLE_APPLICATION_CREDENTIALS。

您可以关注Stackoverflow link,其中 Google 员工提供了有关您面临的应用程序默认凭据异常的相关答案。

【讨论】:

    猜你喜欢
    • 2019-11-15
    • 1970-01-01
    • 1970-01-01
    • 2021-06-30
    • 2023-03-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多