当前位置: 代码迷 >> 综合 >> 谷粒商城P25-Nacos加载多配置集报错-Failed to configure a DataSource: ‘url‘ attribute is not specified and no...
  详细解决方案

谷粒商城P25-Nacos加载多配置集报错-Failed to configure a DataSource: ‘url‘ attribute is not specified and no...

热度:30   发布时间:2023-10-15 19:38:53.0

本文内容是在执行谷粒商城p25-Nacos加载多配置集时报的错。具体操作是将服务模块中application.yml文件中数据源、mybatis及其它部分配置在Nacos的配置中心里。

课程地址:https://www.bilibili.com/video/BV1np4y1C7Yf?p=25

浪费了很多时间,故在此记录。错误原因是粗心。

报错内容如下:

"E:\Program Files\Java\jdk1.8.0_131\bin\java.exe" -XX:TieredStopAtLevel=1 -noverify -Dspring.output.ansi.enabled=always -Dcom.sun.management.jmxremote -Dspring.jmx.enabled=true -Dspring.liveBeansView.mbeanDomain -Dspring.application.admin.enabled=true "-javaagent:E:\Program Files\JetBrains\IntelliJ IDEA 2019.2\lib\idea_rt.jar=1927:E:\Program Files\JetBrains\IntelliJ IDEA 2019.2\bin" -Dfile.encoding=UTF-8 -classpath "E:\Program Files\Java\jdk1.8.0_131\jre\lib\charsets.jar;E:\Program Files\Java\jdk1.8.0_131\jre\lib\deploy.jar;E:\Program Files\Java\jdk1.8.0_131\jre\lib\ext\access-bridge-64.jar;E:\Program Files\Java\jdk1.8.0_131\jre\lib\ext\cldrdata.jar;E:\Program Files\Java\jdk1.8.0_131\jre\lib\ext\dnsns.jar;E:\Program Files\Java\jdk1.8.0_131\jre\lib\ext\jaccess.jar;E:\Program Files\Java\jdk1.8.0_131\jre\lib\ext\jfxrt.jar;E:\Program Files\Java\jdk1.8.0_131\jre\lib\ext\localedata.jar;E:\Program Files\Java\jdk1.8.0_131\jre\lib\ext\nashorn.jar;E:\Program Files\Java\jdk1.8.0_131\jre\lib\ext\sunec.jar;E:\Program Files\Java\jdk1.8.0_131\jre\lib\ext\sunjce_provider.jar;E:\Program Files\Java\jdk1.8.0_131\jre\lib\ext\sunmscapi.jar;E:\Program Files\Java\jdk1.8.0_131\jre\lib\ext\sunpkcs11.jar;E:\Program Files\Java\jdk1.8.0_131\jre\lib\ext\zipfs.jar;E:\Program Files\Java\jdk1.8.0_131\jre\lib\javaws.jar;E:\Program Files\Java\jdk1.8.0_131\jre\lib\jce.jar;E:\Program Files\Java\jdk1.8.0_131\jre\lib\jfr.jar;E:\Program Files\Java\jdk1.8.0_131\jre\lib\jfxswt.jar;E:\Program Files\Java\jdk1.8.0_131\jre\lib\jsse.jar;E:\Program Files\Java\jdk1.8.0_131\jre\lib\management-agent.jar;E:\Program Files\Java\jdk1.8.0_131\jre\lib\plugin.jar;E:\Program Files\Java\jdk1.8.0_131\jre\lib\resources.jar;E:\Program Files\Java\jdk1.8.0_131\jre\lib\rt.jar;E:\IDEAprojects\gulimall\gulimall-coupon\target\classes;E:\IDEAprojects\gulimall\gulimall-common\target\classes;E:\m2\com\baomidou\mybatis-plus-boot-starter\3.4.0\mybatis-plus-boot-starter-3.4.0.jar;E:\m2\com\baomidou\mybatis-plus\3.4.0\mybatis-plus-3.4.0.jar;E:\m2\com\baomidou\mybatis-plus-extension\3.4.0\mybatis-plus-extension-3.4.0.jar;E:\m2\com\baomidou\mybatis-plus-core\3.4.0\mybatis-plus-core-3.4.0.jar;E:\m2\com\baomidou\mybatis-plus-annotation\3.4.0\mybatis-plus-annotation-3.4.0.jar;E:\m2\com\github\jsqlparser\jsqlparser\3.2\jsqlparser-3.2.jar;E:\m2\org\mybatis\mybatis\3.5.5\mybatis-3.5.5.jar;E:\m2\org\mybatis\mybatis-spring\2.0.5\mybatis-spring-2.0.5.jar;E:\m2\org\springframework\boot\spring-boot-autoconfigure\2.3.4.RELEASE\spring-boot-autoconfigure-2.3.4.RELEASE.jar;E:\m2\org\springframework\boot\spring-boot-starter-jdbc\2.3.4.RELEASE\spring-boot-starter-jdbc-2.3.4.RELEASE.jar;E:\m2\com\zaxxer\HikariCP\3.4.5\HikariCP-3.4.5.jar;E:\m2\org\springframework\spring-jdbc\5.2.9.RELEASE\spring-jdbc-5.2.9.RELEASE.jar;E:\m2\org\springframework\spring-tx\5.2.9.RELEASE\spring-tx-5.2.9.RELEASE.jar;E:\m2\org\projectlombok\lombok\1.18.12\lombok-1.18.12.jar;E:\m2\mysql\mysql-connector-java\8.0.21\mysql-connector-java-8.0.21.jar;E:\m2\org\apache\httpcomponents\httpcore\4.4.13\httpcore-4.4.13.jar;E:\m2\commons-lang\commons-lang\2.6\commons-lang-2.6.jar;E:\IDEAprojects\gulimall\renren-fast\target\classes;E:\m2\org\springframework\boot\spring-boot-starter-aop\2.3.4.RELEASE\spring-boot-starter-aop-2.3.4.RELEASE.jar;E:\m2\org\aspectj\aspectjweaver\1.9.6\aspectjweaver-1.9.6.jar;E:\m2\org\springframework\spring-context-support\5.2.9.RELEASE\spring-context-support-5.2.9.RELEASE.jar;E:\m2\org\springframework\boot\spring-boot-starter-data-redis\2.3.4.RELEASE\spring-boot-starter-data-redis-2.3.4.RELEASE.jar;E:\m2\org\springframework\data\spring-data-redis\2.3.4.RELEASE\spring-data-redis-2.3.4.RELEASE.jar;E:\m2\org\springframework\data\spring-data-keyvalue\2.3.4.RELEASE\spring-data-keyvalue-2.3.4.RELEASE.jar;E:\m2\org\springframework\data\spring-data-commons\2.3.4.RELEASE\spring-data-commons-2.3.4.RELEASE.jar;E:\m2\org\springframework\spring-oxm\5.2.9.RELEASE\spring-oxm-5.2.9.RELEASE.jar;E:\m2\io\lettuce\lettuce-core\5.3.4.RELEASE\lettuce-core-5.3.4.RELEASE.jar;E:\m2\io\netty\netty-common\4.1.52.Final\netty-common-4.1.52.Final.jar;E:\m2\io\netty\netty-handler\4.1.52.Final\netty-handler-4.1.52.Final.jar;E:\m2\io\netty\netty-resolver\4.1.52.Final\netty-resolver-4.1.52.Final.jar;E:\m2\io\netty\netty-buffer\4.1.52.Final\netty-buffer-4.1.52.Final.jar;E:\m2\io\netty\netty-codec\4.1.52.Final\netty-codec-4.1.52.Final.jar;E:\m2\io\netty\netty-transport\4.1.52.Final\netty-transport-4.1.52.Final.jar;E:\m2\io\projectreactor\reactor-core\3.3.10.RELEASE\reactor-core-3.3.10.RELEASE.jar;E:\m2\org\reactivestreams\reactive-streams\1.0.3\reactive-streams-1.0.3.jar;E:\m2\com\oracle\ojdbc6\11.2.0.3\ojdbc6-11.2.0.3.jar;E:\m2\com\microsoft\sqlserver\sqljdbc4\4.0\sqljdbc4-4.0.jar;E:\m2\org\postgresql\postgresql\42.2.16\postgresql-42.2.16.jar;E:\m2\org\checkerframework\checker-qual\3.5.0\checker-qual-3.5.0.jar;E:\m2\com\alibaba\druid-spring-boot-starter\1.1.13\druid-spring-boot-starter-1.1.13.jar;E:\m2\com\alibaba\druid\1.1.13\druid-1.1.13.jar;E:\m2\org\quartz-scheduler\quartz\2.3.2\quartz-2.3.2.jar;E:\m2\com\mchange\mchange-commons-java\0.2.15\mchange-commons-java-0.2.15.jar;E:\m2\commons-fileupload\commons-fileupload\1.2.2\commons-fileupload-1.2.2.jar;E:\m2\commons-io\commons-io\2.5\commons-io-2.5.jar;E:\m2\commons-codec\commons-codec\1.14\commons-codec-1.14.jar;E:\m2\commons-configuration\commons-configuration\1.10\commons-configuration-1.10.jar;E:\m2\commons-logging\commons-logging\1.1.1\commons-logging-1.1.1.jar;E:\m2\org\apache\shiro\shiro-core\1.4.0\shiro-core-1.4.0.jar;E:\m2\org\apache\shiro\shiro-lang\1.4.0\shiro-lang-1.4.0.jar;E:\m2\org\apache\shiro\shiro-cache\1.4.0\shiro-cache-1.4.0.jar;E:\m2\org\apache\shiro\shiro-crypto-hash\1.4.0\shiro-crypto-hash-1.4.0.jar;E:\m2\org\apache\shiro\shiro-crypto-core\1.4.0\shiro-crypto-core-1.4.0.jar;E:\m2\org\apache\shiro\shiro-crypto-cipher\1.4.0\shiro-crypto-cipher-1.4.0.jar;E:\m2\org\apache\shiro\shiro-config-core\1.4.0\shiro-config-core-1.4.0.jar;E:\m2\org\apache\shiro\shiro-config-ogdl\1.4.0\shiro-config-ogdl-1.4.0.jar;E:\m2\commons-beanutils\commons-beanutils\1.9.3\commons-beanutils-1.9.3.jar;E:\m2\org\apache\shiro\shiro-event\1.4.0\shiro-event-1.4.0.jar;E:\m2\org\apache\shiro\shiro-spring\1.4.0\shiro-spring-1.4.0.jar;E:\m2\org\apache\shiro\shiro-web\1.4.0\shiro-web-1.4.0.jar;E:\m2\io\jsonwebtoken\jjwt\0.7.0\jjwt-0.7.0.jar;E:\m2\com\github\axet\kaptcha\0.0.9\kaptcha-0.0.9.jar;E:\m2\com\jhlabs\filters\2.0.235\filters-2.0.235.jar;E:\m2\io\springfox\springfox-swagger2\2.7.0\springfox-swagger2-2.7.0.jar;E:\m2\io\swagger\swagger-annotations\1.5.13\swagger-annotations-1.5.13.jar;E:\m2\io\swagger\swagger-models\1.5.13\swagger-models-1.5.13.jar;E:\m2\io\springfox\springfox-spi\2.7.0\springfox-spi-2.7.0.jar;E:\m2\io\springfox\springfox-core\2.7.0\springfox-core-2.7.0.jar;E:\m2\io\springfox\springfox-schema\2.7.0\springfox-schema-2.7.0.jar;E:\m2\io\springfox\springfox-swagger-common\2.7.0\springfox-swagger-common-2.7.0.jar;E:\m2\io\springfox\springfox-spring-web\2.7.0\springfox-spring-web-2.7.0.jar;E:\m2\org\reflections\reflections\0.9.11\reflections-0.9.11.jar;E:\m2\org\javassist\javassist\3.21.0-GA\javassist-3.21.0-GA.jar;E:\m2\com\google\guava\guava\29.0-jre\guava-29.0-jre.jar;E:\m2\com\google\guava\failureaccess\1.0.1\failureaccess-1.0.1.jar;E:\m2\com\google\guava\listenablefuture\9999.0-empty-to-avoid-conflict-with-guava\listenablefuture-9999.0-empty-to-avoid-conflict-with-guava.jar;E:\m2\com\google\errorprone\error_prone_annotations\2.3.4\error_prone_annotations-2.3.4.jar;E:\m2\com\google\j2objc\j2objc-annotations\1.3\j2objc-annotations-1.3.jar;E:\m2\com\fasterxml\classmate\1.5.1\classmate-1.5.1.jar;E:\m2\org\springframework\plugin\spring-plugin-core\1.2.0.RELEASE\spring-plugin-core-1.2.0.RELEASE.jar;E:\m2\org\springframework\plugin\spring-plugin-metadata\1.2.0.RELEASE\spring-plugin-metadata-1.2.0.RELEASE.jar;E:\m2\org\mapstruct\mapstruct\1.1.0.Final\mapstruct-1.1.0.Final.jar;E:\m2\io\springfox\springfox-swagger-ui\2.7.0\springfox-swagger-ui-2.7.0.jar;E:\m2\com\qiniu\qiniu-java-sdk\7.2.23\qiniu-java-sdk-7.2.23.jar;E:\m2\com\squareup\okhttp3\okhttp\3.14.9\okhttp-3.14.9.jar;E:\m2\com\squareup\okio\okio\1.17.2\okio-1.17.2.jar;E:\m2\com\aliyun\oss\aliyun-sdk-oss\2.8.3\aliyun-sdk-oss-2.8.3.jar;E:\m2\org\apache\httpcomponents\httpclient\4.5.12\httpclient-4.5.12.jar;E:\m2\org\jdom\jdom\1.1\jdom-1.1.jar;E:\m2\com\qcloud\cos_api\4.4\cos_api-4.4.jar;E:\m2\org\apache\httpcomponents\httpmime\4.5.12\httpmime-4.5.12.jar;E:\m2\org\json\json\20140107\json-20140107.jar;E:\m2\junit\junit\4.13\junit-4.13.jar;E:\m2\org\hamcrest\hamcrest-core\2.2\hamcrest-core-2.2.jar;E:\m2\joda-time\joda-time\2.9.9\joda-time-2.9.9.jar;E:\m2\com\google\code\gson\gson\2.8.6\gson-2.8.6.jar;E:\m2\com\alibaba\fastjson\1.2.72\fastjson-1.2.72.jar;E:\m2\cn\hutool\hutool-all\4.1.1\hutool-all-4.1.1.jar;E:\m2\com\alibaba\cloud\spring-cloud-starter-alibaba-nacos-discovery\2.2.3.RELEASE\spring-cloud-starter-alibaba-nacos-discovery-2.2.3.RELEASE.jar;E:\m2\com\alibaba\nacos\nacos-client\1.3.3\nacos-client-1.3.3.jar;E:\m2\com\alibaba\nacos\nacos-common\1.3.3\nacos-common-1.3.3.jar;E:\m2\org\apache\httpcomponents\httpasyncclient\4.1.4\httpasyncclient-4.1.4.jar;E:\m2\org\apache\httpcomponents\httpcore-nio\4.4.13\httpcore-nio-4.4.13.jar;E:\m2\com\alibaba\nacos\nacos-api\1.3.3\nacos-api-1.3.3.jar;E:\m2\org\apache\commons\commons-lang3\3.10\commons-lang3-3.10.jar;E:\m2\com\fasterxml\jackson\core\jackson-core\2.11.2\jackson-core-2.11.2.jar;E:\m2\io\prometheus\simpleclient\0.5.0\simpleclient-0.5.0.jar;E:\m2\com\alibaba\spring\spring-context-support\1.0.10\spring-context-support-1.0.10.jar;E:\m2\org\springframework\cloud\spring-cloud-context\2.2.5.RELEASE\spring-cloud-context-2.2.5.RELEASE.jar;E:\m2\org\springframework\cloud\spring-cloud-starter-netflix-ribbon\2.2.5.RELEASE\spring-cloud-starter-netflix-ribbon-2.2.5.RELEASE.jar;E:\m2\org\springframework\cloud\spring-cloud-starter-netflix-archaius\2.2.5.RELEASE\spring-cloud-starter-netflix-archaius-2.2.5.RELEASE.jar;E:\m2\com\netflix\ribbon\ribbon\2.3.0\ribbon-2.3.0.jar;E:\m2\com\netflix\ribbon\ribbon-transport\2.3.0\ribbon-transport-2.3.0.jar;E:\m2\io\reactivex\rxnetty-contexts\0.4.9\rxnetty-contexts-0.4.9.jar;E:\m2\io\reactivex\rxnetty-servo\0.4.9\rxnetty-servo-0.4.9.jar;E:\m2\javax\inject\javax.inject\1\javax.inject-1.jar;E:\m2\io\reactivex\rxnetty\0.4.9\rxnetty-0.4.9.jar;E:\m2\com\netflix\ribbon\ribbon-core\2.3.0\ribbon-core-2.3.0.jar;E:\m2\com\netflix\ribbon\ribbon-httpclient\2.3.0\ribbon-httpclient-2.3.0.jar;E:\m2\commons-collections\commons-collections\3.2.2\commons-collections-3.2.2.jar;E:\m2\com\sun\jersey\jersey-client\1.19.1\jersey-client-1.19.1.jar;E:\m2\com\sun\jersey\jersey-core\1.19.1\jersey-core-1.19.1.jar;E:\m2\javax\ws\rs\jsr311-api\1.1.1\jsr311-api-1.1.1.jar;E:\m2\com\sun\jersey\contribs\jersey-apache-client4\1.19.1\jersey-apache-client4-1.19.1.jar;E:\m2\com\netflix\servo\servo-core\0.12.21\servo-core-0.12.21.jar;E:\m2\com\netflix\netflix-commons\netflix-commons-util\0.3.0\netflix-commons-util-0.3.0.jar;E:\m2\com\netflix\ribbon\ribbon-loadbalancer\2.3.0\ribbon-loadbalancer-2.3.0.jar;E:\m2\com\netflix\netflix-commons\netflix-statistics\0.1.1\netflix-statistics-0.1.1.jar;E:\m2\io\reactivex\rxjava\1.3.8\rxjava-1.3.8.jar;E:\m2\com\alibaba\cloud\spring-cloud-starter-alibaba-nacos-config\2.2.3.RELEASE\spring-cloud-starter-alibaba-nacos-config-2.2.3.RELEASE.jar;E:\m2\org\springframework\boot\spring-boot-starter-web\2.3.4.RELEASE\spring-boot-starter-web-2.3.4.RELEASE.jar;E:\m2\org\springframework\boot\spring-boot-starter\2.3.4.RELEASE\spring-boot-starter-2.3.4.RELEASE.jar;E:\m2\org\springframework\boot\spring-boot\2.3.4.RELEASE\spring-boot-2.3.4.RELEASE.jar;E:\m2\org\springframework\boot\spring-boot-starter-logging\2.3.4.RELEASE\spring-boot-starter-logging-2.3.4.RELEASE.jar;E:\m2\ch\qos\logback\logback-classic\1.2.3\logback-classic-1.2.3.jar;E:\m2\ch\qos\logback\logback-core\1.2.3\logback-core-1.2.3.jar;E:\m2\org\apache\logging\log4j\log4j-to-slf4j\2.13.3\log4j-to-slf4j-2.13.3.jar;E:\m2\org\apache\logging\log4j\log4j-api\2.13.3\log4j-api-2.13.3.jar;E:\m2\org\slf4j\jul-to-slf4j\1.7.30\jul-to-slf4j-1.7.30.jar;E:\m2\jakarta\annotation\jakarta.annotation-api\1.3.5\jakarta.annotation-api-1.3.5.jar;E:\m2\org\yaml\snakeyaml\1.26\snakeyaml-1.26.jar;E:\m2\org\springframework\boot\spring-boot-starter-json\2.3.4.RELEASE\spring-boot-starter-json-2.3.4.RELEASE.jar;E:\m2\com\fasterxml\jackson\core\jackson-databind\2.11.2\jackson-databind-2.11.2.jar;E:\m2\com\fasterxml\jackson\core\jackson-annotations\2.11.2\jackson-annotations-2.11.2.jar;E:\m2\com\fasterxml\jackson\datatype\jackson-datatype-jdk8\2.11.2\jackson-datatype-jdk8-2.11.2.jar;E:\m2\com\fasterxml\jackson\datatype\jackson-datatype-jsr310\2.11.2\jackson-datatype-jsr310-2.11.2.jar;E:\m2\com\fasterxml\jackson\module\jackson-module-parameter-names\2.11.2\jackson-module-parameter-names-2.11.2.jar;E:\m2\org\springframework\boot\spring-boot-starter-tomcat\2.3.4.RELEASE\spring-boot-starter-tomcat-2.3.4.RELEASE.jar;E:\m2\org\apache\tomcat\embed\tomcat-embed-core\9.0.38\tomcat-embed-core-9.0.38.jar;E:\m2\org\glassfish\jakarta.el\3.0.3\jakarta.el-3.0.3.jar;E:\m2\org\apache\tomcat\embed\tomcat-embed-websocket\9.0.38\tomcat-embed-websocket-9.0.38.jar;E:\m2\org\springframework\spring-web\5.2.9.RELEASE\spring-web-5.2.9.RELEASE.jar;E:\m2\org\springframework\spring-beans\5.2.9.RELEASE\spring-beans-5.2.9.RELEASE.jar;E:\m2\org\springframework\spring-webmvc\5.2.9.RELEASE\spring-webmvc-5.2.9.RELEASE.jar;E:\m2\org\springframework\spring-aop\5.2.9.RELEASE\spring-aop-5.2.9.RELEASE.jar;E:\m2\org\springframework\spring-context\5.2.9.RELEASE\spring-context-5.2.9.RELEASE.jar;E:\m2\org\springframework\spring-expression\5.2.9.RELEASE\spring-expression-5.2.9.RELEASE.jar;E:\m2\org\springframework\cloud\spring-cloud-starter-openfeign\2.2.5.RELEASE\spring-cloud-starter-openfeign-2.2.5.RELEASE.jar;E:\m2\org\springframework\cloud\spring-cloud-starter\2.2.5.RELEASE\spring-cloud-starter-2.2.5.RELEASE.jar;E:\m2\org\springframework\security\spring-security-rsa\1.0.9.RELEASE\spring-security-rsa-1.0.9.RELEASE.jar;E:\m2\org\bouncycastle\bcpkix-jdk15on\1.64\bcpkix-jdk15on-1.64.jar;E:\m2\org\bouncycastle\bcprov-jdk15on\1.64\bcprov-jdk15on-1.64.jar;E:\m2\org\springframework\cloud\spring-cloud-openfeign-core\2.2.5.RELEASE\spring-cloud-openfeign-core-2.2.5.RELEASE.jar;E:\m2\org\springframework\cloud\spring-cloud-netflix-ribbon\2.2.5.RELEASE\spring-cloud-netflix-ribbon-2.2.5.RELEASE.jar;E:\m2\org\springframework\cloud\spring-cloud-netflix-archaius\2.2.5.RELEASE\spring-cloud-netflix-archaius-2.2.5.RELEASE.jar;E:\m2\io\github\openfeign\form\feign-form-spring\3.8.0\feign-form-spring-3.8.0.jar;E:\m2\io\github\openfeign\form\feign-form\3.8.0\feign-form-3.8.0.jar;E:\m2\org\springframework\cloud\spring-cloud-commons\2.2.5.RELEASE\spring-cloud-commons-2.2.5.RELEASE.jar;E:\m2\org\springframework\security\spring-security-crypto\5.3.4.RELEASE\spring-security-crypto-5.3.4.RELEASE.jar;E:\m2\io\github\openfeign\feign-core\10.10.1\feign-core-10.10.1.jar;E:\m2\io\github\openfeign\feign-slf4j\10.10.1\feign-slf4j-10.10.1.jar;E:\m2\org\slf4j\slf4j-api\1.7.30\slf4j-api-1.7.30.jar;E:\m2\io\github\openfeign\feign-hystrix\10.10.1\feign-hystrix-10.10.1.jar;E:\m2\com\netflix\archaius\archaius-core\0.7.6\archaius-core-0.7.6.jar;E:\m2\com\google\code\findbugs\jsr305\3.0.1\jsr305-3.0.1.jar;E:\m2\com\netflix\hystrix\hystrix-core\1.5.18\hystrix-core-1.5.18.jar;E:\m2\org\hdrhistogram\HdrHistogram\2.1.9\HdrHistogram-2.1.9.jar;E:\m2\org\hamcrest\hamcrest\2.2\hamcrest-2.2.jar;E:\m2\net\bytebuddy\byte-buddy\1.10.14\byte-buddy-1.10.14.jar;E:\m2\org\springframework\spring-core\5.2.9.RELEASE\spring-core-5.2.9.RELEASE.jar;E:\m2\org\springframework\spring-jcl\5.2.9.RELEASE\spring-jcl-5.2.9.RELEASE.jar" com.atguigu.gulimall.coupon.GulimallCouponApplication
====================================================================================================================欢迎使用 renren-fast 人人快速开发平台 - Powered By https://www.renren.io/====================================================================================================================
2020-11-04 16:56:34.330  INFO 22880 --- [           main] c.a.n.c.c.impl.LocalConfigInfoProcessor  : LOCAL_SNAPSHOT_PATH:C:\Users\HellenaWeng\nacos\config
2020-11-04 16:56:34.380  INFO 22880 --- [           main] c.a.nacos.client.config.impl.Limiter     : limitTime:5.0
2020-11-04 16:56:34.432  INFO 22880 --- [           main] c.a.nacos.client.config.utils.JvmUtil    : isMultiInstance:false
2020-11-04 16:56:34.475  WARN 22880 --- [           main] c.a.c.n.c.NacosPropertySourceBuilder     : Ignore the empty nacos configuration and get it based on dataId[gulimall-coupon] & group[dev]
2020-11-04 16:56:34.481  INFO 22880 --- [           main] b.c.PropertySourceBootstrapConfiguration : Located property source: [BootstrapPropertySource {name='bootstrapProperties-gulimall-coupon.properties,dev'}, BootstrapPropertySource {name='bootstrapProperties-gulimall-coupon,dev'}, BootstrapPropertySource {name='bootstrapProperties-other.yml,dev'}, BootstrapPropertySource {name='bootstrapProperties-mybatis.yml,dev'}, BootstrapPropertySource {name='bootstrapProperties-datasource.yml,dev'}]
2020-11-04 16:56:34.487  INFO 22880 --- [           main] c.a.g.coupon.GulimallCouponApplication   : No active profile set, falling back to default profiles: default
2020-11-04 16:56:35.522  INFO 22880 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Multiple Spring Data modules found, entering strict repository configuration mode!
2020-11-04 16:56:35.527  INFO 22880 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data Redis repositories in DEFAULT mode.
2020-11-04 16:56:35.586  INFO 22880 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 40ms. Found 0 Redis repository interfaces.
2020-11-04 16:56:36.112  INFO 22880 --- [           main] o.s.cloud.context.scope.GenericScope     : BeanFactory id=c45b79b4-4ced-3593-97d6-d9a087fb2f73
2020-11-04 16:56:36.669  INFO 22880 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 7000 (http)
2020-11-04 16:56:36.687  INFO 22880 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2020-11-04 16:56:36.687  INFO 22880 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet engine: [Apache Tomcat/9.0.38]
2020-11-04 16:56:36.690  INFO 22880 --- [           main] o.a.catalina.core.AprLifecycleListener   : An older version [1.2.21] of the Apache Tomcat Native library is installed, while Tomcat recommends a minimum version of [1.2.23]
2020-11-04 16:56:36.690  INFO 22880 --- [           main] o.a.catalina.core.AprLifecycleListener   : Loaded Apache Tomcat Native library [1.2.21] using APR version [1.6.5].
2020-11-04 16:56:36.691  INFO 22880 --- [           main] o.a.catalina.core.AprLifecycleListener   : APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true].
2020-11-04 16:56:36.691  INFO 22880 --- [           main] o.a.catalina.core.AprLifecycleListener   : APR/OpenSSL configuration: useAprConnector [false], useOpenSSL [true]
2020-11-04 16:56:36.697  INFO 22880 --- [           main] o.a.catalina.core.AprLifecycleListener   : OpenSSL successfully initialized [OpenSSL 1.1.1a  20 Nov 2018]
2020-11-04 16:56:36.993  INFO 22880 --- [           main] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2020-11-04 16:56:36.995  INFO 22880 --- [           main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 2482 ms
2020-11-04 16:56:37.189  INFO 22880 --- [           main] c.a.d.s.b.a.DruidDataSourceAutoConfigure : Init DruidDataSource
2020-11-04 16:56:37.380  WARN 22880 --- [           main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'couponHistoryController': Unsatisfied dependency expressed through field 'couponHistoryService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'couponHistoryService': Unsatisfied dependency expressed through field 'baseMapper'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'couponHistoryDao' defined in file [E:\IDEAprojects\gulimall\gulimall-coupon\target\classes\com\atguigu\gulimall\coupon\dao\CouponHistoryDao.class]: Unsatisfied dependency expressed through bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [com/baomidou/mybatisplus/autoconfigure/MybatisPlusAutoConfiguration.class]: Unsatisfied dependency expressed through method 'sqlSessionFactory' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [com/alibaba/druid/spring/boot/autoconfigure/DruidDataSourceAutoConfigure.class]: Invocation of init method failed; nested exception is org.springframework.boot.autoconfigure.jdbc.DataSourceProperties$DataSourceBeanCreationException: Failed to determine a suitable driver class
2020-11-04 16:56:37.382  INFO 22880 --- [           main] o.apache.catalina.core.StandardService   : Stopping service [Tomcat]
2020-11-04 16:56:37.501  INFO 22880 --- [           main] ConditionEvaluationReportLoggingListener : Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2020-11-04 16:56:37.506 ERROR 22880 --- [           main] o.s.b.d.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 classAction: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 (no profiles are currently active).Process finished with exit code 1

一开始用这个错误去搜索,解决方案都是在执行类上加入@EnableAutoConfiguration.../或是在pom文件中加上配置文件的相关配置什么的。

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

都尝试了一遍,无果。

后来发现错误原因是:

datasource.yml文件中的配置应该是:

spring:datasource:username: rootpassword: rooturl: jdbc:mysql://192.168.56.10:3306/gulimall-sms?serverTimezone=UTC&useUnicode=true&characterEncoding=UTF-8driver-class-name: com.mysql.jdbc.Driver

我写成了:

datasource:username: rootpassword: rooturl: jdbc:mysql://192.168.56.10:3306/gulimall-sms?serverTimezone=UTC&useUnicode=true&characterEncoding=UTF-8driver-class-name: com.mysql.jdbc.Driver

少写了spring,所以会报这样的错,以上供参考。各位不要像我一样因为粗心浪费这么多时间吖~

不过浪费这么多时间也是因为我不太会看日志,如果有哪位大神可以提供看这篇日志的思路的还请不吝赐教~

P.S.:

弹幕提供的将Nacos中的配置文件后缀改为yaml文件尝试了一下,和后缀为yml效果一样,只要内容配置对了是可以跑起来的,所以没有发现有什么不同,有疑问的童鞋可以自己试一试。

  相关解决方案