美文网首页
consul做配置中心遇见的BUG

consul做配置中心遇见的BUG

作者: 李小二的倔强 | 来源:发表于2018-09-26 15:06 被阅读0次

今天开发一个微服务的oauth服务,我们用的是consul做配置中心,今天报了一个错误是:

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.

2018-09-26 14:55:42.577 ERROR 8888 --- [          main] o.s.b.d.LoggingFailureAnalysisReporter  :

***************************

APPLICATION FAILED TO START

***************************

Description:

Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured.

Reason: Failed to determine a suitable driver class

Action:

Consider the following:

If you want an embedded database (H2, HSQL or Derby), please put it on the classpath.

If you have database settings to be loaded from a particular profile you may need to activate it (no profiles are currently active).

Disconnected from the target VM, address: '127.0.0.1:53565', transport: 'socket'

Process finished with exit code 1

由于这个错误网上很常见,以前也遇见过,我一看知道是什么问题,这个异常大概的意思是我的pom文件中引入的mybatis的左边没有用到,才会报这样的错,同时只要是在启动类上加上如下注解就可以解决:@EnableAutoConfiguration(exclude={DataSourceAutoConfiguration.class})但是尝试了很久还是没能狗解决,因为以前遇见过,也是同样的方法解决的很奇怪。经过出去抽了只眼,我就一直想不明白为什么,但是我突然想到,昨天调整过pom文件,突然我发现少了一个坐标。

解决方法:加上了如下的坐标

<dependency>

     <groupId>org.springframework.cloud</groupId>

     <artifactId>spring-cloud-starter-consul-config</artifactId>

</dependency>

用consul做配置中心少了这个坐标当然不行了,找了一上午bug,一根烟解决了。

    

相关文章

  • consul做配置中心遇见的BUG

    今天开发一个微服务的oauth服务,我们用的是consul做配置中心,今天报了一个错误是: Error start...

  • consul集群搭建及spring cloud集成

    consul概念解析,集群搭建及作为配置中心与spring cloud集成 Consul是什么? Consul 官...

  • 补课

    Consul 做注册中心和配置中心 Redis做缓存和分布式锁 redis中使用lua脚本[https://blo...

  • Consul 启动

    Consul 可以作为注册中心、也可以作为配置中心官网地址[https://www.consul.io/downl...

  • spring-cloud consul

    consul作为注册中心 consul提供的功能 支持多数据中心的服务注册,服务发现和服务配置 基于raft试下一...

  • Spring Cloud从Consul中获取服务状态

    Spring Cloud使用consul作为服务注册发现配置中心,服务会在consul中注册健康检测地址,所以直接...

  • nginx+consul做动态负载均衡(docker)

    1 consul 1.1 consul简介 Consul 是一个支持多数据中心分布式高可用的服务发现和配置共享的服...

  • Consul集群搭建

    介绍Consul和Eureka一样也可以用来做注册中心, 但是Consul不同于Eureka,Consul包含多个...

  • 配置中心存放文件还是 Key-Value键值对?

    容器的配置文件存放在配置中心(consul)时,会有几种不同的存放方法。最典型的就是将文件直接存放在 配置中心,容...

  • consul安装搭建

    consul安装搭建 介绍 consul是google开源的一个使用go语言开发的服务发现、配置管理中心服务。内置...

网友评论

      本文标题:consul做配置中心遇见的BUG

      本文链接:https://www.haomeiwen.com/subject/ukodoftx.html