gpt4 book ai didi

java - 服务器进入无限循环并给出 GOOGLE_APPLICATION_CREDENTIALS 异常

转载 作者:行者123 更新时间:2023-12-02 01:22:34 25 4
gpt4 key购买 nike

在本地运行我的 java 项目会出现 GOOGLE_APPLICATION_CREDENTIALS 异常。

异常(exception)情况是:

ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'storage' defined in class path resource [org/springframework/cloud/gcp/autoconfigure/storage/GcpStorageAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.google.cloud.storage.Storage]: Factory method 'storage' threw exception; nested exception is 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.

我点击了链接:https://developers.google.com/accounts/docs/application-default-credentials并执行所有提到的步骤。还使用新的 key.json

更新了本地 key 文件

异常的快照是: Error Snap

最佳答案

正如 @bhito 所指出的,使用正确的路径导出 GOOGLE_APPLICATION_CREDENTIALS="[PATH]"解决了问题。

欲了解更多信息,请点击链接: https://cloud.google.com/docs/authentication/production#passing_the_path_to_the_service_account_key_in_code

关于java - 服务器进入无限循环并给出 GOOGLE_APPLICATION_CREDENTIALS 异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57430575/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com