springcloud本地启动指定profile后错误If you are using the git profile, you need to set a Git URI in your confi

Posted 宇翊

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了springcloud本地启动指定profile后错误If you are using the git profile, you need to set a Git URI in your confi相关的知识,希望对你有一定的参考价值。

配置中心指定profile后启动报错

2020-04-22 14:35:48.306 ERROR 22828 --- [  restartedMain] 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 ‘configServerHealthIndicator‘ defined in class path resource [org/springframework/cloud/config/server/config/EnvironmentRepositoryConfiguration.class]: Unsatisfied dependency expressed through method ‘configServerHealthIndicator‘ parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘org.springframework.cloud.config.server.config.CompositeConfiguration‘: Unsatisfied dependency expressed through method ‘setEnvironmentRepos‘ parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘defaultEnvironmentRepository‘ defined in class path resource [org/springframework/cloud/config/server/config/DefaultRepositoryConfiguration.class]: Invocation of init method failed; nested exception is java.lang.IllegalStateException: You need to configure a uri for the git repository.
2020-04-22 14:35:48.334  INFO 22828 --- [  restartedMain] o.apache.catalina.core.StandardService   : Stopping service [Tomcat]
2020-04-22 14:35:48.347  WARN 22828 --- [  restartedMain] o.a.c.loader.WebappClassLoaderBase       : The web application [ROOT] appears to have started a thread named [spring.cloud.inetutils] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
 sun.misc.Unsafe.park(Native Method)
 java.util.concurrent.locks.LockSupport.park(LockSupport.java:175)
 java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2039)
 java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:442)
 java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1074)
 java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1134)
 java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
 java.lang.Thread.run(Thread.java:748)
2020-04-22 14:35:48.350  WARN 22828 --- [  restartedMain] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is org.springframework.boot.web.server.WebServerException: Unable to start embedded Tomcat
2020-04-22 14:35:48.370  INFO 22828 --- [  restartedMain] ConditionEvaluationReportLoggingListener : 

Error starting ApplicationContext. To display the conditions report re-run your application with ‘debug‘ enabled.
2020-04-22 14:35:48.373 ERROR 22828 --- [  restartedMain] o.s.b.d.LoggingFailureAnalysisReporter   : 

***************************
APPLICATION FAILED TO START
***************************

Description:

Invalid config server configuration.

Action:

If you are using the git profile, you need to set a Git URI in your configuration.  If you are using a native profile and have spring.cloud.config.server.bootstrap=true, you need to use a composite configuration.

解决办法:

spring:
  cloud:
    config:
      server:
        git:
          uri:你的项目git路径

 

以上是关于springcloud本地启动指定profile后错误If you are using the git profile, you need to set a Git URI in your confi的主要内容,如果未能解决你的问题,请参考以下文章

springcloud之gateway点滴

SpringCloud 多环境配置文件使用

springcloud 项目jar运行Nacos出错

springcloud项目配置拓展从本地config目录加载

关于启动springboot如果指定多个profile时相同配置的覆盖规律

SpringCloud微服务开发如何协同