解决spring-boot启动中碰到的问题:Cannot determine embedded database driver class for database type NONE(转)
问题 如下:
2017-07-16 08:50:57.436 INFO 13524 --- [ main] c.p.p.web.PointshopWebApplication : Starting PointshopWebApplication on MSI with PID 13524 (D:\javaProject\com.ppdai.pointshop\pointshop-web\target\classes started by yangliweng in D:\javaProject\com.ppdai.pointshop)
2017-07-16 08:50:57.436 INFO 13524 --- [ main] c.p.p.web.PointshopWebApplication : No active profile set, falling back to default profiles: default
2017-07-16 08:50:57.478 INFO 13524 --- [ main] s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@179bb86: startup date [Sun Jul 16 08:50:57 GMT+08:00 2017]; root of context hierarchy
2017-07-16 08:50:57.798 WARN 13524 --- [ main] o.m.s.mapper.ClassPathMapperScanner : No MyBatis mapper was found in '[com.ppdai.pointshop.web.controller, com.ppdai.pointshop.web]' package. Please check your configuration.
2017-07-16 08:50:57.829 INFO 13524 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Multiple Spring Data modules found, entering strict repository configuration mode!
2017-07-16 08:50:58.001 WARN 13524 --- [ main] o.h.v.m.ParameterMessageInterpolator : HV000184: ParameterMessageInterpolator has been chosen, EL interpolation will not be supported
2017-07-16 08:50:58.151 WARN 13524 --- [ main] o.h.v.m.ParameterMessageInterpolator : HV000184: ParameterMessageInterpolator has been chosen, EL interpolation will not be supported
2017-07-16 08:50:58.224 WARN 13524 --- [ main] s.c.a.AnnotationConfigApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfigurationTomcat.class]:Beaninstantiationviafactorymethodfailed;nestedexceptionisorg.springframework.beans.BeanInstantiationException:Failedtoinstantiate[org.apache.tomcat.jdbc.pool.DataSource]:Factorymethod′dataSource′threwexception;nestedexceptionisorg.springframework.boot.autoconfigure.jdbc.DataSourceProperties" role="presentation">Tomcat.class]:Beaninstantiationviafactorymethodfailed;nestedexceptionisorg.springframework.beans.BeanInstantiationException:Failedtoinstantiate[org.apache.tomcat.jdbc.pool.DataSource]:Factorymethod′dataSource′threwexception;nestedexceptionisorg.springframework.boot.autoconfigure.jdbc.DataSourcePropertiesTomcat.class]:Beaninstantiationviafactorymethodfailed;nestedexceptionisorg.springframework.beans.BeanInstantiationException:Failedtoinstantiate[org.apache.tomcat.jdbc.pool.DataSource]:Factorymethod′dataSource′threwexception;nestedexceptionisorg.springframework.boot.autoconfigure.jdbc.DataSourcePropertiesDataSourceBeanCreationException: 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).
2017-07-16 08:50:58.240 INFO 13524 --- [ main] utoConfigurationReportLoggingInitializer :
Error starting ApplicationContext. To display the auto-configuration report re-run your application with 'debug' enabled.
2017-07-16 08:50:58.240 ERROR 13524 --- [ 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).
Process finished with exit code 1
------------------------我是分割线------------------
网上 找到了所谓的解决 方法:
1
2
3
4
5
6
7
8
9
10
11
|
@SpringBootApplication (exclude = { DataSourceAutoConfiguration. class , HibernateJpaAutoConfiguration. class },scanBasePackages = { "com.ppdai.pointshop.web.controller" } ) public class PointshopWebApplication { public static void main(String[] args) { SpringApplication.run(PointshopWebApplication. class , args); } } |
但是很 遗憾 ,没用。
于是 用maven下载 好springboot 的源码,然后断点调试 进去 ,看看 是什么情况,最后 发现了问题的所在:
因为我这是一个新 项目 ,还 没有 配置数据源 ,但是我又想在 没配置数据源的情况 下去 启动项目,该怎么办呢 ?网上找到的方法是无效的,于是我做了一个大胆的猜测:肯定是某个地方加载了这个bean,因为 这是 一个新项目,所以 我觉得 启动加载的可能性很大,而启动 加载 只有 POM文件 里面的依赖才 有可能办到。下面 是 我的dependency依赖:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
<dependencies> <!-- https: //mvnrepository.com/artifact/org.springframework.boot/spring-boot-autoconfigure --> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-autoconfigure</artifactId> <version> 1.5 . 4 .RELEASE</version> </dependency> <!-- https: //mvnrepository.com/artifact/org.springframework.boot/spring-boot --> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot</artifactId> <version> 1.5 . 4 .RELEASE</version> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-aop</artifactId> <version> 1.5 . 4 .RELEASE</version> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-redis</artifactId> <version> 1.5 . 4 .RELEASE</version> </dependency> <dependency> <groupId>org.mybatis.spring.boot</groupId> <artifactId>mybatis-spring-boot-starter</artifactId> <version> 1.3 . 0 </version> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> <version> 1.5 . 4 .RELEASE</version> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-tomcat</artifactId> <version> 1.5 . 4 .RELEASE</version> <scope>provided</scope> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <version> 1.5 . 4 .RELEASE</version> <scope>test</scope> </dependency> <!-- https: //mvnrepository.com/artifact/org.springframework/spring-core --> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-core</artifactId> <version> 4.3 . 9 .RELEASE</version> </dependency> <!-- https: //mvnrepository.com/artifact/org.springframework/spring-context --> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-context</artifactId> <version> 4.3 . 9 .RELEASE</version> </dependency> </dependencies> |
一个个排查,最后查到org.mybatis.spring.boot这个依赖 ,注释掉即可,可以发现,调试的时候 beannames明显少了很多。
1
2
3
4
5
|
<dependency> <groupId>org.mybatis.spring.boot</groupId> <artifactId>mybatis-spring-boot-starter</artifactId> <version> 1.3 . 0 </version> </dependency> |
最终,Spring Boot 启动成功!
解决spring-boot启动中碰到的问题:Cannot determine embedded database driver class for database type NONE(转)的更多相关文章
- Spring Boot 启动失败,描述/Description: Cannot determine embedded database driver class for database type NONE
异常截图====> 快速解决方式==> 在SpringBoot的启动类上面添加注解:@EnableAutoConfiguration(exclude={DataSourceAutoConf ...
- 解决spring boot启动报错java.lang.NoClassDefFoundError: ch/qos/logback/classic/Level
解决spring boot启动报错java.lang.NoClassDefFoundError: ch/qos/logback/classic/Level 学习了:https://blog.csdn. ...
- 解决 spring boot 线程中使用@Autowired注入Bean的方法,报java.lang.NullPointerException异常
问题描述 在开发中,因某些业务逻辑执行时间太长,我们常使用线程来实现.常规服务实现类中,使用 @Autowired 来注入Bean,来调用其中的方法.但如果在线程类中使用@Autowired注入的Be ...
- 解决spring-boot启动中碰到的问题:Cannot determine embedded database driver class for database type NONE
问题 如下: 2017-07-16 08:50:57.436 INFO 13524 --- [ main] c.p.p.web.PointshopWebApplication ...
- Spring Boot 2中对于CORS跨域访问的快速支持
原文:https://www.jianshu.com/p/840b4f83c3b5 目前的程序开发,大部分都采用前后台分离.这样一来,就都会碰到跨域资源共享CORS的问题.Spring Boot 2 ...
- Spring boot 启动报错:com.mongodb.MongoSocketOpenException: Exception opening socket
详细错误信息: com.mongodb.MongoSocketOpenException: Exception opening socket at com.mongodb.connection.Soc ...
- spring boot 启动遇到报错:Failed to configure a DataSource
spring boot 启动遇到报错,具体如下 Description: Failed to configure a DataSource: 'url' attribute is not speci ...
- 解决Spring Boot 从1.x升级到 2.x 后 单点登陆(SSO)问题
解决Spring Boot 从1.x升级到 2.x 后 单点登陆(SSO)问题 在学习Spring Cloud 时,遇到了授权服务oauth 相关内容时,总是一知半解,因此决定先把Spring S ...
- 【原创】大叔经验分享(67)spring boot启动报错
spring boot 启动报错: Caused by: java.lang.IllegalArgumentException: LoggerFactory is not a Logback Logg ...
随机推荐
- JAVA学习第四十六课 — 其它对象API(二)Date类 & Calendar类(重点掌握)
Date类(重点) 开发时,会时常遇见时间显示的情况,所以必须熟练Date的应用 <span style="font-family:KaiTi_GB2312;font-size:18p ...
- Android学习路线(十二)Activity生命周期——启动一个Activity
DEMO下载地址:http://download.csdn.net/detail/sweetvvck/7728735 不像其他的编程模式那样应用是通过main()函数启动的.Android系统通过调用 ...
- 陈-朱-兴- js写法【案例】:
ajax请求: 一.从服务器端请求数据: var url = '';url = 'https://api.weixin.qq.com/sns/oauth2/access_token?appid='+ ...
- hdoj--1005--Number Sequence(规律题)
Number Sequence Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) ...
- 8.queue
#include <iostream> #include <stack> #include <algorithm> #include <list> #i ...
- hbase伪分布安装配置
hbase1.2.4 伪分布式安装 注意:在安装hbase或者hadoop的时候,要注意hadoop和hbase的对应关系.如果版本不对应可能造成系统的不稳定和一些其他的问题.在hbase的lib ...
- PUBG
题目描述 最近,喜爱ACM的PBY同学沉迷吃鸡,无法自拔,于是又来到了熟悉的ERANGEL.经过一番搜寻,PBY同学准备动身前往安全区,但是,地图中埋伏了许多LYB,PBY的枪法很差,希望你能够帮他找 ...
- 在windows下如何新建爬虫虚拟环境和进行scrapy安装
Scrapy是Python开发的一个快速.高层次的屏幕抓取和web抓取框架,用于抓取web站点并从页面中提取结构化的数据.Scrapy吸引人的地方在于它是一个框架,任何人都可以根据需求方便的修改.Sc ...
- TF.LSTM实现
感悟:耗时最多的就是数据格式整理,其本身并不复杂 NN-LSTM-NN-SOFTMAX 数据格式:batch_size =>批大小,n_steps=>要建立多少lstm 0.原始输入数据格 ...
- 13-Linux中进程与线程的概念以及区别
linux进程与线程的区别,早已成为IT界经常讨论但热度不减的话题.无论你是初级程序员,还是资深专家,都应该考虑过这个问题,只是层次角度不同罢了.对于一般的程序员,搞清楚二者的概念并在工作中学会运用是 ...