报错信息

  1. ***************************
  2. APPLICATION FAILED TO START
  3. ***************************
  4. Description:
  5. Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured.
  6. Reason: Failed to determine a suitable driver class
  7. Action:
  8. Consider the following:
  9. If you want an embedded database (H2, HSQL or Derby), please put it on the classpath.
  10. If you have database settings to be loaded from a particular profile you may need to activate it (no profiles are currently active).
  11. Process finished with exit code 1

解决方案

  • Nacos 没有配置对应服务的数据库连接信息
  • 微服务无法连接读取nacos配置信息 (host没配置,本地vpn影响解析等原因)

    其他原因

    :::warning 此报错正常情况下是由于配置文件加载错误导致,虽然 nacos 对应的微服务已经配置配置文件,但是由于 nacos 加载的规则不能正确加载或者不能正确解析。 :::

DEBUG NacosConfigDataLoader 源代码: ① 、②

  • ① 获取到 nacos 配置文件结果
  • ② 配置文件解析异常内容

服务启动失败 Failed to configure a DataSource: 'url' - 图1