Open ulongx opened 7 years ago
cloud-config-server项目运行时,没有加载到配置cloud-configd-dev.properties文件,springboot 无法读取到dataSource相关的配置信息,当spring创建dataSource bean因缺少相关的信息就会报错。
怎么才能看到正确加载到了../cloud-config-repo/cloud-configd-dev.properties 这个配置呢
我也存在在这个问题- -请问你i解决了吗
@gaoxiang1316 把地址配置到git里面读取了,可以了。本地目录就是读不到,没搞清楚
@ulongx @gaoxiang1316 下午好,我曾debug过,使用../这种相对路径是没有办法加载到配置中心的(暂时不清楚是不是springcloud的bug),建议使用git、svn或绝对路径。
读取不到 数据库配置;我在 simple-service中 又配置了一次数据库。。。。
我也是遇到同样的问题,是讲cloud-config-server中的spring.cloud.config.server.native.searchLocations=../cloud-config-repo修改为git或者svn的地址吗?
顺便可以加下qq或者微信吗?捐了钱发现加不了好友,哈哈
cloud-config-repo 我把这个配置文件 放到 cloud-config-server 项目中,然后配置改为如下就可以了 spring.cloud.config.server.native.searchLocations=classpath:/cloud-config-repo
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
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
有没有更好的办法解决这个问题,开发阶段到没有多大的问题,如果是应用于生产感觉配置中心没有多大的用处了
解决办法(和上面大神说的一样): 把配置文件cloud-config-repo 放到 cloud-config-server 项目src/resource下,与数据库配置文件同级,然后配置改为如下 spring.cloud.config.server.native.searchLocations=classpath:/cloud-config-repo即可
最后需要把cloud-vue改成你自己的数据库名字
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