SpringBoot启动报错Failed to determine a suitable driver class

"/Applications/IntelliJ IDEA 15.app/Contents/jre/jdk/Contents/Home/bin/java" -Didea.launcher.port=7537 "-Didea.launcher.bin.path=/Applications/IntelliJ IDEA 15.app/Contents/bin" -Dfile.encoding=UTF-8 -classpath "/Applications/IntelliJ IDEA 15.app/Contents/jre/jdk/Contents/Home/jre/lib/charsets.jar:/Applications/IntelliJ IDEA 15.app/Contents/jre/jdk/Contents/Home/jre/lib/ext/cldrdata.jar:/Applications/IntelliJ IDEA 15.app/Contents/jre/jdk/Contents/Home/jre/lib/ext/dnsns.jar:/Applications/IntelliJ IDEA 15.app/Contents/jre/jdk/Contents/Home/jre/lib/ext/jaccess.jar:/Applications/IntelliJ IDEA 15.app/Contents/jre/jdk/Contents/Home/jre/lib/ext/localedata.jar:/Applications/IntelliJ IDEA 15.app/Contents/jre/jdk/Contents/Home/jre/lib/ext/nashorn.jar:/Applications/IntelliJ IDEA 15.app/Contents/jre/jdk/Contents/Home/jre/lib/ext/sunec.jar:/Applications/IntelliJ IDEA 15.app/Contents/jre/jdk/Contents/Home/jre/lib/ext/sunjce_provider.jar:/Applications/IntelliJ IDEA 15.app/Contents/jre/jdk/Contents/Home/jre/lib/ext/sunpkcs11.jar:/Applications/IntelliJ IDEA 15.app/Contents/jre/jdk/Contents/Home/jre/lib/ext/zipfs.jar:/Applications/IntelliJ IDEA 15.app/Contents/jre/jdk/Contents/Home/jre/lib/jce.jar:/Applications/IntelliJ IDEA 15.app/Contents/jre/jdk/Contents/Home/jre/lib/jsse.jar:/Applications/IntelliJ IDEA 15.app/Contents/jre/jdk/Contents/Home/jre/lib/management-agent.jar:/Applications/IntelliJ IDEA 15.app/Contents/jre/jdk/Contents/Home/jre/lib/resources.jar:/Applications/IntelliJ IDEA 15.app/Contents/jre/jdk/Contents/Home/jre/lib/rt.jar:/Applications/IntelliJ IDEA 15.app/Contents/jre/jdk/Contents/Home/lib/dt.jar:/Applications/IntelliJ IDEA 15.app/Contents/jre/jdk/Contents/Home/lib/jconsole.jar:/Applications/IntelliJ IDEA 15.app/Contents/jre/jdk/Contents/Home/lib/sa-jdi.jar:/Applications/IntelliJ IDEA 15.app/Contents/jre/jdk/Contents/Home/lib/tools.jar:/Users/zhangxinyue/Documents/IdeaProject/springboot-mybatis/target/classes:/Users/zhangxinyue/.m2/repository/org/springframework/boot/spring-boot-starter-jdbc/2.2.9.RELEASE/spring-boot-starter-jdbc-2.2.9.RELEASE.jar:/Users/zhangxinyue/.m2/repository/org/springframework/boot/spring-boot-starter/2.2.9.RELEASE/spring-boot-starter-2.2.9.RELEASE.jar:/Users/zhangxinyue/.m2/repository/org/springframework/boot/spring-boot/2.2.9.RELEASE/spring-boot-2.2.9.RELEASE.jar:/Users/zhangxinyue/.m2/repository/org/springframework/boot/spring-boot-starter-logging/2.2.9.RELEASE/spring-boot-starter-logging-2.2.9.RELEASE.jar:/Users/zhangxinyue/.m2/repository/ch/qos/logback/logback-classic/1.2.3/logback-classic-1.2.3.jar:/Users/zhangxinyue/.m2/repository/ch/qos/logback/logback-core/1.2.3/logback-core-1.2.3.jar:/Users/zhangxinyue/.m2/repository/org/apache/logging/log4j/log4j-to-slf4j/2.12.1/log4j-to-slf4j-2.12.1.jar:/Users/zhangxinyue/.m2/repository/org/apache/logging/log4j/log4j-api/2.12.1/log4j-api-2.12.1.jar:/Users/zhangxinyue/.m2/repository/org/slf4j/jul-to-slf4j/1.7.30/jul-to-slf4j-1.7.30.jar:/Users/zhangxinyue/.m2/repository/jakarta/annotation/jakarta.annotation-api/1.3.5/jakarta.annotation-api-1.3.5.jar:/Users/zhangxinyue/.m2/repository/org/yaml/snakeyaml/1.25/snakeyaml-1.25.jar:/Users/zhangxinyue/.m2/repository/com/zaxxer/HikariCP/3.4.5/HikariCP-3.4.5.jar:/Users/zhangxinyue/.m2/repository/org/springframework/spring-jdbc/5.2.8.RELEASE/spring-jdbc-5.2.8.RELEASE.jar:/Users/zhangxinyue/.m2/repository/org/springframework/spring-beans/5.2.8.RELEASE/spring-beans-5.2.8.RELEASE.jar:/Users/zhangxinyue/.m2/repository/org/springframework/spring-tx/5.2.8.RELEASE/spring-tx-5.2.8.RELEASE.jar:/Users/zhangxinyue/.m2/repository/org/springframework/boot/spring-boot-starter-web/2.2.9.RELEASE/spring-boot-starter-web-2.2.9.RELEASE.jar:/Users/zhangxinyue/.m2/repository/org/springframework/boot/spring-boot-starter-json/2.2.9.RELEASE/spring-boot-starter-json-2.2.9.RELEASE.jar:/Users/zhangxinyue/.m2/repository/com/fasterxml/jackson/core/jackson-databind/2.10.5/jackson-databind-2.10.5.jar:/Users/zhangxinyue/.m2/repository/com/fasterxml/jackson/core/jackson-annotations/2.10.5/jackson-annotations-2.10.5.jar:/Users/zhangxinyue/.m2/repository/com/fasterxml/jackson/core/jackson-core/2.10.5/jackson-core-2.10.5.jar:/Users/zhangxinyue/.m2/repository/com/fasterxml/jackson/datatype/jackson-datatype-jdk8/2.10.5/jackson-datatype-jdk8-2.10.5.jar:/Users/zhangxinyue/.m2/repository/com/fasterxml/jackson/datatype/jackson-datatype-jsr310/2.10.5/jackson-datatype-jsr310-2.10.5.jar:/Users/zhangxinyue/.m2/repository/com/fasterxml/jackson/module/jackson-module-parameter-names/2.10.5/jackson-module-parameter-names-2.10.5.jar:/Users/zhangxinyue/.m2/repository/org/springframework/boot/spring-boot-starter-tomcat/2.2.9.RELEASE/spring-boot-starter-tomcat-2.2.9.RELEASE.jar:/Users/zhangxinyue/.m2/repository/org/apache/tomcat/embed/tomcat-embed-core/9.0.37/tomcat-embed-core-9.0.37.jar:/Users/zhangxinyue/.m2/repository/org/apache/tomcat/embed/tomcat-embed-el/9.0.37/tomcat-embed-el-9.0.37.jar:/Users/zhangxinyue/.m2/repository/org/apache/tomcat/embed/tomcat-embed-websocket/9.0.37/tomcat-embed-websocket-9.0.37.jar:/Users/zhangxinyue/.m2/repository/org/springframework/boot/spring-boot-starter-validation/2.2.9.RELEASE/spring-boot-starter-validation-2.2.9.RELEASE.jar:/Users/zhangxinyue/.m2/repository/jakarta/validation/jakarta.validation-api/2.0.2/jakarta.validation-api-2.0.2.jar:/Users/zhangxinyue/.m2/repository/org/hibernate/validator/hibernate-validator/6.0.20.Final/hibernate-validator-6.0.20.Final.jar:/Users/zhangxinyue/.m2/repository/org/jboss/logging/jboss-logging/3.4.1.Final/jboss-logging-3.4.1.Final.jar:/Users/zhangxinyue/.m2/repository/com/fasterxml/classmate/1.5.1/classmate-1.5.1.jar:/Users/zhangxinyue/.m2/repository/org/springframework/spring-web/5.2.8.RELEASE/spring-web-5.2.8.RELEASE.jar:/Users/zhangxinyue/.m2/repository/org/springframework/spring-webmvc/5.2.8.RELEASE/spring-webmvc-5.2.8.RELEASE.jar:/Users/zhangxinyue/.m2/repository/org/springframework/spring-aop/5.2.8.RELEASE/spring-aop-5.2.8.RELEASE.jar:/Users/zhangxinyue/.m2/repository/org/springframework/spring-context/5.2.8.RELEASE/spring-context-5.2.8.RELEASE.jar:/Users/zhangxinyue/.m2/repository/org/springframework/spring-expression/5.2.8.RELEASE/spring-expression-5.2.8.RELEASE.jar:/Users/zhangxinyue/.m2/repository/mysql/mysql-connector-java/8.0.21/mysql-connector-java-8.0.21.jar:/Users/zhangxinyue/.m2/repository/org/springframework/spring-core/5.2.8.RELEASE/spring-core-5.2.8.RELEASE.jar:/Users/zhangxinyue/.m2/repository/org/springframework/spring-jcl/5.2.8.RELEASE/spring-jcl-5.2.8.RELEASE.jar:/Users/zhangxinyue/.m2/repository/org/mybatis/spring/boot/mybatis-spring-boot-starter/2.1.4/mybatis-spring-boot-starter-2.1.4.jar:/Users/zhangxinyue/.m2/repository/org/mybatis/spring/boot/mybatis-spring-boot-autoconfigure/2.1.4/mybatis-spring-boot-autoconfigure-2.1.4.jar:/Users/zhangxinyue/.m2/repository/org/mybatis/mybatis/3.5.6/mybatis-3.5.6.jar:/Users/zhangxinyue/.m2/repository/org/mybatis/mybatis-spring/2.0.6/mybatis-spring-2.0.6.jar:/Users/zhangxinyue/.m2/repository/org/projectlombok/lombok/1.18.12/lombok-1.18.12.jar:/Users/zhangxinyue/.m2/repository/com/alibaba/druid-spring-boot-starter/1.1.9/druid-spring-boot-starter-1.1.9.jar:/Users/zhangxinyue/.m2/repository/com/alibaba/druid/1.1.9/druid-1.1.9.jar:/Users/zhangxinyue/.m2/repository/org/slf4j/slf4j-api/1.7.30/slf4j-api-1.7.30.jar:/Users/zhangxinyue/.m2/repository/org/springframework/boot/spring-boot-autoconfigure/2.2.9.RELEASE/spring-boot-autoconfigure-2.2.9.RELEASE.jar:/Applications/IntelliJ IDEA 15.app/Contents/lib/idea_rt.jar" com.intellij.rt.execution.application.AppMain com.zxy.SpringbootMybatisApplication --spring.output.ansi.enabled=always

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::        (v2.2.9.RELEASE)

2021-08-30 14:51:51.082  INFO 38930 --- [           main] com.zxy.SpringbootMybatisApplication     : Starting SpringbootMybatisApplication on localhost with PID 38930 (/Users/zhangxinyue/Documents/IdeaProject/springboot-mybatis/target/classes started by zhangxinyue in /Users/zhangxinyue/Documents/IdeaProject/springboot-mybatis)
2021-08-30 14:51:51.087  INFO 38930 --- [           main] com.zxy.SpringbootMybatisApplication     : The following profiles are active: test
2021-08-30 14:51:52.673  INFO 38930 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 8082 (http)
2021-08-30 14:51:52.688  INFO 38930 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2021-08-30 14:51:52.689  INFO 38930 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet engine: [Apache Tomcat/9.0.37]
2021-08-30 14:51:52.784  INFO 38930 --- [           main] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2021-08-30 14:51:52.784  INFO 38930 --- [           main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 1568 ms
2021-08-30 14:51:52.899  INFO 38930 --- [           main] c.a.d.s.b.a.DruidDataSourceAutoConfigure : Init DruidDataSource
2021-08-30 14:51:53.013  WARN 38930 --- [           main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'courseCurriculumController': Unsatisfied dependency expressed through field 'courseCurriculumMapper'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'courseCurriculumMapper' defined in file [/Users/zhangxinyue/Documents/IdeaProject/springboot-mybatis/target/classes/com/zxy/mapper/CourseCurriculumMapper.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 [org/mybatis/spring/boot/autoconfigure/MybatisAutoConfiguration.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
2021-08-30 14:51:53.016  INFO 38930 --- [           main] o.apache.catalina.core.StandardService   : Stopping service [Tomcat]
2021-08-30 14:51:53.091  INFO 38930 --- [           main] ConditionEvaluationReportLoggingListener : 

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2021-08-30 14:51:53.093 ERROR 38930 --- [           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 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 (no profiles are currently active).


Process finished with exit code 1

在启动类的@SpringBootApplication加上

    @SpringBootApplication(exclude = { DataSourceAutoConfiguration.class, DataSourceTransactionManagerAutoConfiguration.class })

在application.properties里配置:

    spring.autoconfigure.exclude=org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration,org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration

问题记录

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值