[尝试启动我的Spring Boot应用程序时,即使设置了密码,我也会获得所需的google凭据

问题描述 投票:0回答:1

现在,我有一个用Maven构建的spring boot应用程序。在IntelliJ中,我将运行它,它会给我这个错误日志。最后一个错误为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。但是我确实有他们。在我的环境变量中,我有GOOGLE_APPLICATION_CREDENTIALS指向我的credentials.json的路径。

.   ____          _            __ _ _
/\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/  ___)| |_)| | | | | || (_| |  ) ) ) )
 '  |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot ::        (v2.2.1.RELEASE)

2020-06-10 18:52:49.503  INFO 5100 --- [           main] c.t.n.sms.AdobeSmsBatchApplication       : No active profile set, falling back to default profiles: default
2020-06-10 18:52:51.232  INFO 5100 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Multiple Spring Data modules found, entering strict repository configuration mode!
2020-06-10 18:52:51.238  INFO 5100 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data repositories in DEFAULT mode.
2020-06-10 18:52:51.314  INFO 5100 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 45ms. Found 0 repository interfaces.
2020-06-10 18:52:51.869  INFO 5100 --- [           main] o.s.cloud.context.scope.GenericScope     : BeanFactory id=758dfa85-446e-37a3-9779-5d6170ddccf1
2020-06-10 18:52:52.908  INFO 5100 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 8080 (http)
2020-06-10 18:52:52.934  INFO 5100 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2020-06-10 18:52:52.934  INFO 5100 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet engine: [Apache Tomcat/9.0.27]
2020-06-10 18:52:53.207  INFO 5100 --- [           main] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2020-06-10 18:52:53.208  INFO 5100 --- [           main] o.s.web.context.ContextLoader            : Root WebApplicationContext: initialization completed in 3662 ms
2020-06-10 18:52:53.670  INFO 5100 --- [           main] o.s.c.g.a.c.GcpContextAutoConfiguration  : The default project ID is cio-notification-np-93822f
2020-06-10 18:52:53.696  INFO 5100 --- [           main] c.g.a.oauth2.ComputeEngineCredentials    : Failed to detect whether we are running on Google Compute Engine.
2020-06-10 18:52:53.699  WARN 5100 --- [           main] o.s.c.g.core.DefaultCredentialsProvider  : No core credentials are set. Service-specific credentials (e.g., spring.cloud.gcp.pubsub.credentials.*) should be used if your app uses services that require credentials.
2020-06-10 18:52:53.731  INFO 5100 --- [           main] o.s.s.c.ThreadPoolTaskScheduler          : Initializing ExecutorService 'pubsubPublisherThreadPool'
2020-06-10 18:52:53.815  INFO 5100 --- [           main] o.s.s.c.ThreadPoolTaskScheduler          : Initializing ExecutorService 'pubsubSubscriberThreadPool'
2020-06-10 18:52:53.863  INFO 5100 --- [           main] o.s.s.concurrent.ThreadPoolTaskExecutor  : Initializing ExecutorService 'pubSubAcknowledgementExecutor'
2020-06-10 18:52:54.110 ERROR 5100 --- [           main] o.s.b.web.embedded.tomcat.TomcatStarter  : Error starting Tomcat context. Exception: org.springframework.beans.factory.BeanCreationException. Message: 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 'pubSubHealthIndicator' defined in class path resource [org/springframework/cloud/gcp/autoconfigure/pubsub/health/PubSubHealthIndicatorAutoConfiguration.class]: Unsatisfied dependency expressed through method 'pubSubHealthIndicator' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'pubSubTemplate' defined in class path resource [org/springframework/cloud/gcp/autoconfigure/pubsub/GcpPubSubAutoConfiguration.class]: Unsatisfied dependency expressed through method 'pubSubTemplate' parameter 1; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'pubSubSubscriberTemplate' defined in class path resource [org/springframework/cloud/gcp/autoconfigure/pubsub/GcpPubSubAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.cloud.gcp.pubsub.core.subscriber.PubSubSubscriberTemplate]: Factory method 'pubSubSubscriberTemplate' threw exception; nested exception is java.lang.RuntimeException: Error creating the SubscriberStub
2020-06-10 18:52:54.150  INFO 5100 --- [           main] o.apache.catalina.core.StandardService   : Stopping service [Tomcat]

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2020-06-10 18:52:54.212 ERROR 5100 --- [           main] o.s.boot.SpringApplication               : Application run failed

org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is org.springframework.boot.web.server.WebServerException: Unable to start embedded Tomcat
 at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:156) ~[spring-boot-2.2.1.RELEASE.jar:2.2.1.RELEASE]
 at com.telus.notification.sms.AdobeSmsBatchApplication.main(AdobeSmsBatchApplication.java:11) ~[classes/:na]
Caused by: org.springframework.boot.web.server.WebServerException: Unable to start embedded Tomcat
 at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.initialize(TomcatWebServer.java:126) ~[spring-boot-2.2.1.RELEASE.jar:2.2.1.RELEASE]
 at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.<init>(TomcatWebServer.java:88) ~[spring-boot-2.2.1.RELEASE.jar:2.2.1.RELEASE]
... 8 common frames omitted
Caused by: 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 'pubSubHealthIndicator' defined in class path resource [org/springframework/cloud/gcp/autoconfigure/pubsub/health/PubSubHealthIndicatorAutoConfiguration.class]: Unsatisfied dependency expressed through method 'pubSubHealthIndicator' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'pubSubTemplate' defined in class path resource [org/springframework/cloud/gcp/autoconfigure/pubsub/GcpPubSubAutoConfiguration.class]: Unsatisfied dependency expressed through method 'pubSubTemplate' parameter 1; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'pubSubSubscriberTemplate' defined in class path resource [org/springframework/cloud/gcp/autoconfigure/pubsub/GcpPubSubAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.cloud.gcp.pubsub.core.subscriber.PubSubSubscriberTemplate]: Factory method 'pubSubSubscriberTemplate' threw exception; nested exception is java.lang.RuntimeException: Error creating the SubscriberStub
 at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:645) ~[spring-beans-5.2.1.RELEASE.jar:5.2.1.RELEASE]
 at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:625) ~[spring-beans-5.2.1.RELEASE.jar:5.2.1.RELEASE]
... 13 common frames omitted
Caused by: 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 'pubSubHealthIndicator' defined in class path resource [org/springframework/cloud/gcp/autoconfigure/pubsub/health/PubSubHealthIndicatorAutoConfiguration.class]: Unsatisfied dependency expressed through method 'pubSubHealthIndicator' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'pubSubTemplate' defined in class path resource [org/springframework/cloud/gcp/autoconfigure/pubsub/GcpPubSubAutoConfiguration.class]: Unsatisfied dependency expressed through method 'pubSubTemplate' parameter 1; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'pubSubSubscriberTemplate' defined in class path resource [org/springframework/cloud/gcp/autoconfigure/pubsub/GcpPubSubAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.cloud.gcp.pubsub.core.subscriber.PubSubSubscriberTemplate]: Factory method 'pubSubSubscriberTemplate' threw exception; nested exception is java.lang.RuntimeException: Error creating the SubscriberStub
 at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185) ~[spring-beans-5.2.1.RELEASE.jar:5.2.1.RELEASE]
 at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:640) ~[spring-beans-5.2.1.RELEASE.jar:5.2.1.RELEASE]
 ... 53 common frames omitted
Caused by: 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 'pubSubHealthIndicator' defined in class path resource [org/springframework/cloud/gcp/autoconfigure/pubsub/health/PubSubHealthIndicatorAutoConfiguration.class]: Unsatisfied dependency expressed through method 'pubSubHealthIndicator' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'pubSubTemplate' defined in class path resource [org/springframework/cloud/gcp/autoconfigure/pubsub/GcpPubSubAutoConfiguration.class]: Unsatisfied dependency expressed through method 'pubSubTemplate' parameter 1; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'pubSubSubscriberTemplate' defined in class path resource [org/springframework/cloud/gcp/autoconfigure/pubsub/GcpPubSubAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.cloud.gcp.pubsub.core.subscriber.PubSubSubscriberTemplate]: Factory method 'pubSubSubscriberTemplate' threw exception; nested exception is java.lang.RuntimeException: Error creating the SubscriberStub
 at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:787) ~[spring-beans-5.2.1.RELEASE.jar:5.2.1.RELEASE]
... 54 common frames omitted
Caused by: 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 'pubSubHealthIndicator' defined in class path resource [org/springframework/cloud/gcp/autoconfigure/pubsub/health/PubSubHealthIndicatorAutoConfiguration.class]: Unsatisfied dependency expressed through method 'pubSubHealthIndicator' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'pubSubTemplate' defined in class path resource [org/springframework/cloud/gcp/autoconfigure/pubsub/GcpPubSubAutoConfiguration.class]: Unsatisfied dependency expressed through method 'pubSubTemplate' parameter 1; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'pubSubSubscriberTemplate' defined in class path resource [org/springframework/cloud/gcp/autoconfigure/pubsub/GcpPubSubAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.cloud.gcp.pubsub.core.subscriber.PubSubSubscriberTemplate]: Factory method 'pubSubSubscriberTemplate' threw exception; nested exception is java.lang.RuntimeException: Error creating the SubscriberStub
 at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:645) ~[spring-beans-5.2.1.RELEASE.jar:5.2.1.RELEASE]
... 74 common frames omitted
Caused by: 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 'pubSubHealthIndicator' defined in class path resource [org/springframework/cloud/gcp/autoconfigure/pubsub/health/PubSubHealthIndicatorAutoConfiguration.class]: Unsatisfied dependency expressed through method 'pubSubHealthIndicator' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'pubSubTemplate' defined in class path resource [org/springframework/cloud/gcp/autoconfigure/pubsub/GcpPubSubAutoConfiguration.class]: Unsatisfied dependency expressed through method 'pubSubTemplate' parameter 1; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'pubSubSubscriberTemplate' defined in class path resource [org/springframework/cloud/gcp/autoconfigure/pubsub/GcpPubSubAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.cloud.gcp.pubsub.core.subscriber.PubSubSubscriberTemplate]: Factory method 'pubSubSubscriberTemplate' threw exception; nested exception is java.lang.RuntimeException: Error creating the SubscriberStub
 at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185) ~[spring-beans-5.2.1.RELEASE.jar:5.2.1.RELEASE]
 at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:640) ~[spring-beans-5.2.1.RELEASE.jar:5.2.1.RELEASE]
 ... 88 common frames omitted
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'pubSubHealthIndicator' defined in class path resource [org/springframework/cloud/gcp/autoconfigure/pubsub/health/PubSubHealthIndicatorAutoConfiguration.class]: Unsatisfied dependency expressed through method 'pubSubHealthIndicator' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'pubSubTemplate' defined in class path resource [org/springframework/cloud/gcp/autoconfigure/pubsub/GcpPubSubAutoConfiguration.class]: Unsatisfied dependency expressed through method 'pubSubTemplate' parameter 1; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'pubSubSubscriberTemplate' defined in class path resource [org/springframework/cloud/gcp/autoconfigure/pubsub/GcpPubSubAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.cloud.gcp.pubsub.core.subscriber.PubSubSubscriberTemplate]: Factory method 'pubSubSubscriberTemplate' threw exception; nested exception is java.lang.RuntimeException: Error creating the SubscriberStub
 at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:787) ~[spring-beans-5.2.1.RELEASE.jar:5.2.1.RELEASE]
... 89 common frames omitted
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'pubSubTemplate' defined in class path resource [org/springframework/cloud/gcp/autoconfigure/pubsub/GcpPubSubAutoConfiguration.class]: Unsatisfied dependency expressed through method 'pubSubTemplate' parameter 1; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'pubSubSubscriberTemplate' defined in class path resource [org/springframework/cloud/gcp/autoconfigure/pubsub/GcpPubSubAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.cloud.gcp.pubsub.core.subscriber.PubSubSubscriberTemplate]: Factory method 'pubSubSubscriberTemplate' threw exception; nested exception is java.lang.RuntimeException: Error creating the SubscriberStub
 at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:787) ~[spring-beans-5.2.1.RELEASE.jar:5.2.1.RELEASE]
 at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:528) ~[spring-beans-5.2.1.RELEASE.jar:5.2.1.RELEASE]
 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1338) ~[spring-beans-5.2.1.RELEASE.jar:5.2.1.RELEASE]
 ... 107 common frames omitted
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'pubSubSubscriberTemplate' defined in class path resource [org/springframework/cloud/gcp/autoconfigure/pubsub/GcpPubSubAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.cloud.gcp.pubsub.core.subscriber.PubSubSubscriberTemplate]: Factory method 'pubSubSubscriberTemplate' threw exception; nested exception is java.lang.RuntimeException: Error creating the SubscriberStub
 at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:645) ~[spring-beans-5.2.1.RELEASE.jar:5.2.1.RELEASE]
 at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:625) ~[spring-beans-5.2.1.RELEASE.jar:5.2.1.RELEASE]
 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1338) ~[spring-beans-5.2.1.RELEASE.jar:5.2.1.RELEASE]
 ... 121 common frames omitted
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.cloud.gcp.pubsub.core.subscriber.PubSubSubscriberTemplate]: Factory method 'pubSubSubscriberTemplate' threw exception; nested exception is java.lang.RuntimeException: Error creating the SubscriberStub
 at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185) ~[spring-beans-5.2.1.RELEASE.jar:5.2.1.RELEASE]
 at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:640) ~[spring-beans-5.2.1.RELEASE.jar:5.2.1.RELEASE]
 ... 135 common frames omitted
Caused by: java.lang.RuntimeException: Error creating the SubscriberStub
 at org.springframework.cloud.gcp.pubsub.support.DefaultSubscriberFactory.createSubscriberStub(DefaultSubscriberFactory.java:277) ~[spring-cloud-gcp-pubsub-1.2.2.RELEASE.jar:1.2.2.RELEASE]
 at org.springframework.cloud.gcp.pubsub.core.subscriber.PubSubSubscriberTemplate.<init>(PubSubSubscriberTemplate.java:100) ~[spring-cloud-gcp-pubsub-1.2.2.RELEASE.jar:1.2.2.RELEASE]
 at org.springframework.cloud.gcp.autoconfigure.pubsub.GcpPubSubAutoConfiguration.pubSubSubscriberTemplate(GcpPubSubAutoConfiguration.java:171) ~[spring-cloud-gcp-autoconfigure-1.2.2.RELEASE.jar:1.2.2.RELEASE]
 at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154) ~[spring-beans-5.2.1.RELEASE.jar:5.2.1.RELEASE]
 ... 136 common frames omitted
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.
 at com.google.auth.oauth2.DefaultCredentialsProvider.getDefaultCredentials(DefaultCredentialsProvider.java:134) ~[google-auth-library-oauth2-http-0.20.0.jar:na]
 at com.google.auth.oauth2.GoogleCredentials.getApplicationDefault(GoogleCredentials.java:119) ~[google-auth-library-oauth2-http-0.20.0.jar:na]
 at com.google.auth.oauth2.GoogleCredentials.getApplicationDefault(GoogleCredentials.java:91) ~[google-auth-library-oauth2-http-0.20.0.jar:na]
 at com.google.api.gax.core.GoogleCredentialsProvider.getCredentials(GoogleCredentialsProvider.java:67) ~[gax-1.54.0.jar:1.54.0]
 at org.springframework.cloud.gcp.core.DefaultCredentialsProvider.getCredentials(DefaultCredentialsProvider.java:67) ~[spring-cloud-gcp-core-1.2.2.RELEASE.jar:1.2.2.RELEASE]
 at com.google.api.gax.rpc.ClientContext.create(ClientContext.java:135) ~[gax-1.54.0.jar:1.54.0]
 at com.google.cloud.pubsub.v1.stub.GrpcSubscriberStub.create(GrpcSubscriberStub.java:263) ~[google-cloud-pubsub-1.103.0.jar:1.103.0]
 at org.springframework.cloud.gcp.pubsub.support.DefaultSubscriberFactory.createSubscriberStub(DefaultSubscriberFactory.java:274) ~[spring-cloud-gcp-pubsub-1.2.2.RELEASE.jar:1.2.2.RELEASE]
 ... 148 common frames omitted


Process finished with exit code 1
java spring-boot maven intellij-idea google-cloud-platform
1个回答
0
投票

如果使用Intellij,则打开菜单:运行/编辑配置。如果没有新面板,请在新面板的左列单击+添加Spring Boot应用程序。当您的Spring Boot Application位于左侧列的右侧时,单击Configuration选项卡,查找Environment,将其展开。查找环境变量,单击右侧的编辑图标,然后添加GOOGLE_APPLICATION_CREDENTIALS及其路径。保存并再次运行您的应用程序。这样就可以了。如果构建jar并使用java -jar运行,则必须export GOOGLE_APPLICATION_CREDENTIALS="path/to/key.json"。另一种方法:您也可以在Mac和Windows上设置系统范围的环境变量来解决此问题。

© www.soinside.com 2019 - 2024. All rights reserved.