请稍等 ...
×

采纳答案成功!

向帮助你的同学说点啥吧!感谢那些助人为乐的人

config远端仓库的client端报错

config server 启动可以拿到配置文件,但是启动order就报错,yml文件也改成了bootstrap.yml,
bootstrap的配置内容:
spring:
application:
name: order
cloud:
config:
discovery:
enabled: true
service-id: CONFIG
profile: dev
debug: true
报错内容:
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).
图片描述图片描述

这里是标题文字

正在回答

4回答

廖师兄 2018-09-18 23:36:55

可以说下怎么解决的,并采纳为正确答案

0 回复 有任何疑惑可以回复我~
一路向北吧 2019-08-07 15:51:00

该问题也折腾了很久,发现如果注册中心不是采用默认的8761端口,需要在client端追加配置,例如

eureka:
 client:
   service-url:
     defaultZone: http://localhost:8762/eureka/

才能正常取值CONFIG服务端配置信息

0 回复 有任何疑惑可以回复我~
提问者 慕虎3103396 2018-09-25 09:07:21

将端口号改成默认的8761就可以了


0 回复 有任何疑惑可以回复我~
  • 你好同学,请问是-Dserver.port=8081改成-Dserver.port=8761还是eureka:
      client:
        service-url:
          defaultZone: http://localhost:8761/eureka/这里?
    
    这是我的git 上的配置文件
    spring:
      application:
        name: order
      datasource:
        driver-class-name: com.mysql.jdbc.Driver
        username: root
        password: root
        url: jdbc:mysql://127.0.0.1:3306/springcloud_sell?characterEncoding=utf-8&useSSL=false
      rabbitmq:
        host: 127.0.0.1
        port: 5672
        username: guest
        password: guest
    env:
      test13
    girl:
      name: mo
      age: 17
    eureka:
      client:
        service-url:
          defaultZone: http://localhost:8761/eureka/
    
    bootstrap.yml内容
    spring:
    #  application:
    #    name: order
      cloud:
        config:
          discovery:
            enabled: true
            service-id: CONFIG
          profile: test
    希望同学指点一下,谢谢啦
    回复 有任何疑惑可以回复我~ 2018-11-17 08:46:22
提问者 慕虎3103396 2018-09-18 10:56:58

问题已经解决了

0 回复 有任何疑惑可以回复我~
问题已解决,确定采纳
还有疑问,暂不采纳
意见反馈 帮助中心 APP下载
官方微信