3
重启应用偶尔出现报错:Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured 报错后重新启动就好了,不是必现,但是出现的很频繁。 nacos:2.1.0 SpringCloudAlibaba:2.2.9 MySQL:8.0.28 配置:
spring:
application:
name: supplier-service
cloud:
nacos:
config:
server-addr: ${nacos.server-addr}
username: ${nacos.username}
password: ${nacos.password}
namespace: dev
extension-configs:
- data-id: mysql-db-config.yml
group: DEFAULT_GROUP
- data-id: redis-config.yml
group: DEFAULT_GROUP
- data-id: oauth2-config.yml
group: DEFAULT_GROUP
refresh: true
nacos:
server-addr: juru.nacos-dev.jrmall.cn:90
username: nacos
password: nacos
错误日志如下:
2023-07-20 19:50:54.816 [enterprise-service] [main] INFO c.a.d.s.b.a.DruidDataSourceAutoConfigure - [] Init DruidDataSource
2023-07-20 19:50:55.390 [enterprise-service] [main] INFO org.apache.catalina.core.StandardService - [] Stopping service [Tomcat]
2023-07-20 19:50:55.563 [enterprise-service] [main] ERROR o.s.b.diagnostics.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 (the profiles prod are currently active).