Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
ulongx opened this issue Jun 14, 2017 · 12 comments

Comments

@ulongx
Copy link

ulongx commented Jun 14, 2017

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
Copy link
Owner

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

@ulongx
Copy link
Author

ulongx commented Jul 5, 2017

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

@gaoxiang1316
Copy link

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

@ulongx
Copy link
Author

ulongx commented Jul 26, 2017

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

@OptionalDay
Copy link
Owner

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

@mvphjx
Copy link

mvphjx commented Sep 29, 2017

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

@guke001
Copy link

guke001 commented Jan 5, 2018

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

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

@SmileTower
Copy link

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

@407205745
Copy link

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
Copy link

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
Copy link

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

@yuantong0407
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants