IDEA下启动springboot项目报错, Cannot determine embedded database driver class for database type NONE

在网上各种查阅资料,都说是配置问题。但本人反复检查配置没有问题。

因为使用 IDEA 开发,需要将maven项目中的  resources 目录标记为  


application.properties   配置如下

logging.config=classpath:log4j2.xml

## 数据源配置
spring.datasource.url=jdbc:mysql://127.0.0.1:3306/springboot_shiro?useUnicode=true&characterEncoding=utf8&useSSL=true
spring.datasource.username=root
# spring.datasource.password=root
spring.datasource.password=123456
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
spring.datasource.max-idle=10
spring.datasource.max-wait=10000
spring.datasource.min-idle=5
spring.datasource.initial-size=5


## Mybatis 配置
mybatis.typeAliasesPackage=com.xm.shiro.admin.entity
mybatis.mapperLocations=classpath:*.xml


log4j2.xml 配置如下

<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="OFF">
    <Appenders>
        <Console name="Console" target="SYSTEM_OUT">
            <!--控制台只输出level及以上级别的信息(onMatch),其他的直接拒绝(onMismatch)-->
            <ThresholdFilter level="debug" onMatch="ACCEPT" onMismatch="DENY"/>
            <PatternLayout pattern="%d{yyyy.MM.dd 'at' HH:mm:ss z} %-5level %class{36} %M() @%L - %msg%n"/>
        </Console>
        <File name="ERROR" fileName="logs/error.log" append="false">
            <ThresholdFilter level="error" onMatch="ACCEPT" onMismatch="DENY"/>
            <PatternLayout pattern="%d{yyyy.MM.dd 'at' HH:mm:ss z} %-5level %class{36} %M() @%L - %msg%n"/>
        </File>
        <!--这个会打印出所有的信息,每次大小超过size,则这size大小的日志会自动存入按年份-月份建立的文件夹下面并进行压缩,作为存档-->
        <RollingFile name="RollingFile" fileName="logs/app.log"
                     filePattern="log/$${date:yyyy-MM}/app-%d{MM-dd-yyyy}-%i.log.gz">
            <PatternLayout pattern="%d{yyyy.MM.dd 'at' HH:mm:ss z} %-5level %class{36} %M() @%L - %msg%n"/>
            <SizeBasedTriggeringPolicy size="5MB"/>
        </RollingFile>
    </Appenders>
    <Loggers>
        <Root level="DEBUG">
            <appender-ref ref="ERROR" />
            <appender-ref ref="RollingFile"/>
            <appender-ref ref="Console"/>
        </Root>
    </Loggers>
</Configuration>

启动报错

"E:\Program Files\Java\jdk1.8.0_172\bin\java.exe" -agentlib:jdwp=transport=dt_socket,address=127.0.0.1:58062,suspend=y,server=n -javaagent:C:\Users\Administrator\.IntelliJIdea2018.1\system\captureAgent\debugger-agent.jar=file:/C:/Users/Administrator/AppData/Local/Temp/capture.props -Dfile.encoding=UTF-8 -classpath "E:\Program Files\Java\jdk1.8.0_172\jre\lib\charsets.jar;E:\Program Files\Java\jdk1.8.0_172\jre\lib\deploy.jar;E:\Program Files\Java\jdk1.8.0_172\jre\lib\ext\access-bridge-64.jar;E:\Program Files\Java\jdk1.8.0_172\jre\lib\ext\cldrdata.jar;E:\Program Files\Java\jdk1.8.0_172\jre\lib\ext\dnsns.jar;E:\Program Files\Java\jdk1.8.0_172\jre\lib\ext\jaccess.jar;E:\Program Files\Java\jdk1.8.0_172\jre\lib\ext\jfxrt.jar;E:\Program Files\Java\jdk1.8.0_172\jre\lib\ext\localedata.jar;E:\Program Files\Java\jdk1.8.0_172\jre\lib\ext\nashorn.jar;E:\Program Files\Java\jdk1.8.0_172\jre\lib\ext\sunec.jar;E:\Program Files\Java\jdk1.8.0_172\jre\lib\ext\sunjce_provider.jar;E:\Program Files\Java\jdk1.8.0_172\jre\lib\ext\sunmscapi.jar;E:\Program Files\Java\jdk1.8.0_172\jre\lib\ext\sunpkcs11.jar;E:\Program Files\Java\jdk1.8.0_172\jre\lib\ext\zipfs.jar;E:\Program Files\Java\jdk1.8.0_172\jre\lib\javaws.jar;E:\Program Files\Java\jdk1.8.0_172\jre\lib\jce.jar;E:\Program Files\Java\jdk1.8.0_172\jre\lib\jfr.jar;E:\Program Files\Java\jdk1.8.0_172\jre\lib\jfxswt.jar;E:\Program Files\Java\jdk1.8.0_172\jre\lib\jsse.jar;E:\Program Files\Java\jdk1.8.0_172\jre\lib\management-agent.jar;E:\Program Files\Java\jdk1.8.0_172\jre\lib\plugin.jar;E:\Program Files\Java\jdk1.8.0_172\jre\lib\resources.jar;E:\Program Files\Java\jdk1.8.0_172\jre\lib\rt.jar;F:\GitRepositoryLocal\springboot-study\springboot-shiro\target\classes;E:\maven\localRepository\org\springframework\boot\spring-boot-starter-web\1.5.13.RELEASE\spring-boot-starter-web-1.5.13.RELEASE.jar;E:\maven\localRepository\org\springframework\boot\spring-boot-starter\1.5.13.RELEASE\spring-boot-starter-1.5.13.RELEASE.jar;E:\maven\localRepository\org\springframework\boot\spring-boot\1.5.13.RELEASE\spring-boot-1.5.13.RELEASE.jar;E:\maven\localRepository\org\springframework\boot\spring-boot-autoconfigure\1.5.13.RELEASE\spring-boot-autoconfigure-1.5.13.RELEASE.jar;E:\maven\localRepository\org\yaml\snakeyaml\1.17\snakeyaml-1.17.jar;E:\maven\localRepository\org\springframework\boot\spring-boot-starter-tomcat\1.5.13.RELEASE\spring-boot-starter-tomcat-1.5.13.RELEASE.jar;E:\maven\localRepository\org\apache\tomcat\embed\tomcat-embed-core\8.5.31\tomcat-embed-core-8.5.31.jar;E:\maven\localRepository\org\apache\tomcat\tomcat-annotations-api\8.5.31\tomcat-annotations-api-8.5.31.jar;E:\maven\localRepository\org\apache\tomcat\embed\tomcat-embed-el\8.5.31\tomcat-embed-el-8.5.31.jar;E:\maven\localRepository\org\apache\tomcat\embed\tomcat-embed-websocket\8.5.31\tomcat-embed-websocket-8.5.31.jar;E:\maven\localRepository\org\hibernate\hibernate-validator\5.3.6.Final\hibernate-validator-5.3.6.Final.jar;E:\maven\localRepository\javax\validation\validation-api\1.1.0.Final\validation-api-1.1.0.Final.jar;E:\maven\localRepository\org\jboss\logging\jboss-logging\3.3.2.Final\jboss-logging-3.3.2.Final.jar;E:\maven\localRepository\com\fasterxml\classmate\1.3.4\classmate-1.3.4.jar;E:\maven\localRepository\com\fasterxml\jackson\core\jackson-databind\2.8.11.1\jackson-databind-2.8.11.1.jar;E:\maven\localRepository\com\fasterxml\jackson\core\jackson-annotations\2.8.0\jackson-annotations-2.8.0.jar;E:\maven\localRepository\com\fasterxml\jackson\core\jackson-core\2.8.11\jackson-core-2.8.11.jar;E:\maven\localRepository\org\springframework\spring-web\4.3.17.RELEASE\spring-web-4.3.17.RELEASE.jar;E:\maven\localRepository\org\springframework\spring-aop\4.3.17.RELEASE\spring-aop-4.3.17.RELEASE.jar;E:\maven\localRepository\org\springframework\spring-beans\4.3.17.RELEASE\spring-beans-4.3.17.RELEASE.jar;E:\maven\localRepository\org\springframework\spring-context\4.3.17.RELEASE\spring-context-4.3.17.RELEASE.jar;E:\maven\localRepository\org\springframework\spring-webmvc\4.3.17.RELEASE\spring-webmvc-4.3.17.RELEASE.jar;E:\maven\localRepository\org\springframework\spring-expression\4.3.17.RELEASE\spring-expression-4.3.17.RELEASE.jar;E:\maven\localRepository\org\slf4j\slf4j-api\1.7.25\slf4j-api-1.7.25.jar;E:\maven\localRepository\org\springframework\spring-core\4.3.17.RELEASE\spring-core-4.3.17.RELEASE.jar;E:\maven\localRepository\org\mybatis\spring\boot\mybatis-spring-boot-starter\1.2.0\mybatis-spring-boot-starter-1.2.0.jar;E:\maven\localRepository\org\mybatis\spring\boot\mybatis-spring-boot-autoconfigure\1.2.0\mybatis-spring-boot-autoconfigure-1.2.0.jar;E:\maven\localRepository\org\mybatis\mybatis\3.4.2\mybatis-3.4.2.jar;E:\maven\localRepository\org\mybatis\mybatis-spring\1.3.1\mybatis-spring-1.3.1.jar;E:\maven\localRepository\mysql\mysql-connector-java\5.1.46\mysql-connector-java-5.1.46.jar;E:\maven\localRepository\org\apache\shiro\shiro-spring\1.4.0\shiro-spring-1.4.0.jar;E:\maven\localRepository\org\apache\shiro\shiro-core\1.4.0\shiro-core-1.4.0.jar;E:\maven\localRepository\org\apache\shiro\shiro-lang\1.4.0\shiro-lang-1.4.0.jar;E:\maven\localRepository\org\apache\shiro\shiro-crypto-hash\1.4.0\shiro-crypto-hash-1.4.0.jar;E:\maven\localRepository\org\apache\shiro\shiro-crypto-core\1.4.0\shiro-crypto-core-1.4.0.jar;E:\maven\localRepository\org\apache\shiro\shiro-crypto-cipher\1.4.0\shiro-crypto-cipher-1.4.0.jar;E:\maven\localRepository\org\apache\shiro\shiro-config-core\1.4.0\shiro-config-core-1.4.0.jar;E:\maven\localRepository\org\apache\shiro\shiro-config-ogdl\1.4.0\shiro-config-ogdl-1.4.0.jar;E:\maven\localRepository\commons-beanutils\commons-beanutils\1.9.3\commons-beanutils-1.9.3.jar;E:\maven\localRepository\commons-collections\commons-collections\3.2.2\commons-collections-3.2.2.jar;E:\maven\localRepository\org\apache\shiro\shiro-event\1.4.0\shiro-event-1.4.0.jar;E:\maven\localRepository\org\apache\shiro\shiro-web\1.4.0\shiro-web-1.4.0.jar;E:\maven\localRepository\org\apache\shiro\shiro-ehcache\1.4.0\shiro-ehcache-1.4.0.jar;E:\maven\localRepository\org\apache\shiro\shiro-cache\1.4.0\shiro-cache-1.4.0.jar;E:\maven\localRepository\net\sf\ehcache\ehcache-core\2.6.11\ehcache-core-2.6.11.jar;E:\maven\localRepository\org\springframework\boot\spring-boot-starter-jdbc\1.5.13.RELEASE\spring-boot-starter-jdbc-1.5.13.RELEASE.jar;E:\maven\localRepository\org\apache\tomcat\tomcat-jdbc\8.5.31\tomcat-jdbc-8.5.31.jar;E:\maven\localRepository\org\apache\tomcat\tomcat-juli\8.5.31\tomcat-juli-8.5.31.jar;E:\maven\localRepository\org\springframework\spring-jdbc\4.3.17.RELEASE\spring-jdbc-4.3.17.RELEASE.jar;E:\maven\localRepository\org\springframework\spring-tx\4.3.17.RELEASE\spring-tx-4.3.17.RELEASE.jar;E:\maven\localRepository\org\springframework\boot\spring-boot-starter-log4j2\1.5.13.RELEASE\spring-boot-starter-log4j2-1.5.13.RELEASE.jar;E:\maven\localRepository\org\apache\logging\log4j\log4j-slf4j-impl\2.7\log4j-slf4j-impl-2.7.jar;E:\maven\localRepository\org\apache\logging\log4j\log4j-api\2.7\log4j-api-2.7.jar;E:\maven\localRepository\org\apache\logging\log4j\log4j-core\2.7\log4j-core-2.7.jar;E:\maven\localRepository\org\slf4j\jcl-over-slf4j\1.7.25\jcl-over-slf4j-1.7.25.jar;E:\maven\localRepository\org\slf4j\jul-to-slf4j\1.7.25\jul-to-slf4j-1.7.25.jar;E:\Program Files\JetBrains\IntelliJ IDEA 2018.1.4\lib\idea_rt.jar" com.Application

Connected to the target VM, address: '127.0.0.1:58062', transport: 'socket'


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


2018-06-10 15:08:28.392  INFO 2796 --- [           main] c.Application                            : Starting Application on BF-20180524CYVR with PID 2796 (F:\GitRepositoryLocal\springboot-study\springboot-shiro\target\classes started by Administrator in F:\GitRepositoryLocal\springboot-study\springboot-shiro)
2018-06-10 15:08:28.396  INFO 2796 --- [           main] c.Application                            : No active profile set, falling back to default profiles: default
2018-06-10 15:08:28.444  INFO 2796 --- [           main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@3b00856b: startup date [Sun Jun 10 15:08:28 CST 2018]; root of context hierarchy
2018-06-10 15:08:29.706  INFO 2796 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'shiroConfiguration' of type [com.xm.shiro.config.ShiroConfiguration$$EnhancerBySpringCGLIB$$1838c48b] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2018-06-10 15:08:30.348  INFO 2796 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'mybatis-org.mybatis.spring.boot.autoconfigure.MybatisProperties' of type [org.mybatis.spring.boot.autoconfigure.MybatisProperties] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2018-06-10 15:08:30.359  INFO 2796 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'org.mybatis.spring.boot.autoconfigure.MybatisAutoConfiguration' of type [org.mybatis.spring.boot.autoconfigure.MybatisAutoConfiguration$$EnhancerBySpringCGLIB$$56c6b1ae] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2018-06-10 15:08:30.366  INFO 2796 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.boot.autoconfigure.jdbc.DataSourceConfiguration$Tomcat' of type [org.springframework.boot.autoconfigure.jdbc.DataSourceConfiguration$Tomcat] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2018-06-10 15:08:30.388  INFO 2796 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'spring.datasource-org.springframework.boot.autoconfigure.jdbc.DataSourceProperties' of type [org.springframework.boot.autoconfigure.jdbc.DataSourceProperties] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2018-06-10 15:08:30.392  WARN 2796 --- [           main] ationConfigEmbeddedWebApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'methodValidationPostProcessor' defined in class path resource [org/springframework/boot/autoconfigure/validation/ValidationAutoConfiguration.class]: Unsatisfied dependency expressed through method 'methodValidationPostProcessor' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'shiroFilter' defined in class path resource [com/xm/shiro/config/ShiroConfiguration.class]: Unsatisfied dependency expressed through method 'shiroFilterFactoryBean' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'securityManager' defined in class path resource [com/xm/shiro/config/ShiroConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.shiro.web.mgt.DefaultWebSecurityManager]: Factory method 'securityManager' threw exception; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'shiroRealm': Unsatisfied dependency expressed through field 'uUserDao'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'UUserDao' defined in file [F:\GitRepositoryLocal\springboot-study\springboot-shiro\target\classes\com\xm\shiro\admin\dao\UUserDao.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 [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Tomcat.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.tomcat.jdbc.pool.DataSource]: Factory method 'dataSource' threw exception; nested exception is org.springframework.boot.autoconfigure.jdbc.DataSourceProperties$DataSourceBeanCreationException: Cannot determine embedded database driver class for database type NONE. 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 (no profiles are currently active).
2018-06-10 15:08:30.401  INFO 2796 --- [           main] utoConfigurationReportLoggingInitializer : 


Error starting ApplicationContext. To display the auto-configuration report re-run your application with 'debug' enabled.
2018-06-10 15:08:30.415 ERROR 2796 --- [           main] 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 (no profiles are currently active).


Disconnected from the target VM, address: '127.0.0.1:58062', transport: 'socket'


Process finished with exit code 1



resources 目录标记为  resources root 后,启动 springboot 项目不在报错。

最近才从 eclipse 切换到 IDEA ,IDEA 用的有点不熟悉。


  • 2
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值