OptionalDay / spring-cloud-vue

cloud-vue是一套基于springcloud + mybatis + vue全家桶(Vue2.x + Vue-router2.x + Vuex)的前后端分离框架. 使用Maven对项目进行模块化管理,提高项目的易开发性、扩展性。 系统包括分布式配置、eureka注册中心、服务中心、zipkin分布式跟踪等。 每个模块服务多系统部署,注册到同一个eureka集群服务注册中心,实现集群部署。
783 stars 410 forks source link

cloud-simple-service 启动链接不到数据库,是我哪里配置有问题么? #2

Open ulongx opened 7 years ago

ulongx commented 7 years ago

image

cloud-simple-service 启动链接不到数据库,是我哪里配置有问题么?

Error starting ApplicationContext. To display the auto-configuration report re-run your application with 'debug' enabled. 2017-06-14 10:52:49.321 ERROR [cloud-simple-service,,,] 2219 --- [ restartedMain] o.s.b.d.LoggingFailureAnalysisReporter :


APPLICATION FAILED TO START


Description:

Cannot determine embedded database driver class for database type NONE

Action:

If you want an embedded database please put a supported one on the classpath. If you have database settings to be loaded from a particular profile you may need to active it (the profiles "dev,swagger" are currently active).

Process finished with exit code 0

OptionalDay commented 7 years ago

cloud-config-server项目运行时,没有加载到配置cloud-configd-dev.properties文件,springboot 无法读取到dataSource相关的配置信息,当spring创建dataSource bean因缺少相关的信息就会报错。

ulongx commented 7 years ago

怎么才能看到正确加载到了../cloud-config-repo/cloud-configd-dev.properties 这个配置呢

gaoxiang1316 commented 7 years ago

我也存在在这个问题- -请问你i解决了吗

ulongx commented 7 years ago

@gaoxiang1316 把地址配置到git里面读取了,可以了。本地目录就是读不到,没搞清楚

OptionalDay commented 7 years ago

@ulongx @gaoxiang1316 下午好,我曾debug过,使用../这种相对路径是没有办法加载到配置中心的(暂时不清楚是不是springcloud的bug),建议使用git、svn或绝对路径。

mvphjx commented 6 years ago

读取不到 数据库配置;我在 simple-service中 又配置了一次数据库。。。。

guke001 commented 6 years ago

我也是遇到同样的问题,是讲cloud-config-server中的spring.cloud.config.server.native.searchLocations=../cloud-config-repo修改为git或者svn的地址吗?

顺便可以加下qq或者微信吗?捐了钱发现加不了好友,哈哈

SmileTower commented 6 years ago

cloud-config-repo 我把这个配置文件 放到 cloud-config-server 项目中,然后配置改为如下就可以了 spring.cloud.config.server.native.searchLocations=classpath:/cloud-config-repo

407205745 commented 6 years ago

spring.cloud.config.server.native.searchLocations=../cloud-config-repo这个设置的路径有问题吧,导致spring cloud config找不到对应的配置。解决方法一个是按上面那位修改这个路径,另一个办法是不用spring cloud config直接在cloud-simple-service服务的properties中添加数据库配置,比如 spring.datasource.url = jdbc:mysql://localhost:3306/cloud-vue?useUnicode=true&characterEncoding=utf8&useSSL=false spring.datasource.username = root spring.datasource.password = root spring.datasource.driverClassName = com.mysql.jdbc.Driver

spring.datasource.max-active=20 spring.datasource.min-idle=1 spring.datasource.initial-size=1 spring.datasource.test-on-borrow=true

xiaodaguang commented 6 years ago

spring.cloud.config.server.native.searchLocations=../cloud-config-repo这个设置的路径有问题吧,导致spring cloud config找不到对应的配置。解决方法一个是按上面那位修改这个路径,另一个办法是不用spring cloud config直接在cloud-simple-service服务的properties中添加数据库配置,比如 spring.datasource.url = jdbc:mysql://localhost:3306/cloud-vue?useUnicode=true&characterEncoding=utf8&useSSL=false spring.datasource.username = root spring.datasource.password = root spring.datasource.driverClassName = com.mysql.jdbc.Driver

spring.datasource.max-active=20 spring.datasource.min-idle=1 spring.datasource.initial-size=1 spring.datasource.test-on-borrow=true

有没有更好的办法解决这个问题,开发阶段到没有多大的问题,如果是应用于生产感觉配置中心没有多大的用处了

luliangyu commented 4 years ago

解决办法(和上面大神说的一样): 把配置文件cloud-config-repo 放到 cloud-config-server 项目src/resource下,与数据库配置文件同级,然后配置改为如下 spring.cloud.config.server.native.searchLocations=classpath:/cloud-config-repo即可

yuantong0407 commented 4 years ago

最后需要把cloud-vue改成你自己的数据库名字