spring-boot报错Exception encountered during context initialization
来源:互联网 发布:淘宝直邮需要身份证吗 编辑:程序博客网 时间:2024/05/30 23:10
今天准备把我之前搭建的,基于springboot的框架的基础功能包抽离出来,在增加spring yml自定义设置后,在业务项目启动时会报出以下异常。
2017-02-23 18:55:09.869 WARN main org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext[refresh:550] - 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/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 (the profiles "dev,redis,config,mongodb,activemq,socketio" are currently active).2017-02-23 18:55:14.322 INFO main com.corundumstudio.socketio.SocketIOServer[stop:198] - SocketIO server stopped2017-02-23 18:55:14.349 INFO main org.springframework.boot.autoconfigure.logging.AutoConfigurationReportLoggingInitializer[logAutoConfigurationReport:101] - Error starting ApplicationContext. To display the auto-configuration report re-run your application with 'debug' enabled.2017-02-23 18:55:14.355 ERROR main org.springframework.boot.diagnostics.LoggingFailureAnalysisReporter[report:42] - ***************************APPLICATION FAILED TO START***************************Description:Cannot determine embedded database driver class for database type NONEAction: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 (the profiles "dev,redis,config,mongodb,activemq,socketio" are currently active).
在多方查证后,需要在启动类的@EnableAutoConfiguration或@SpringBootApplication中添加exclude = {DataSourceAutoConfiguration.class},排除此类的autoconfig。启动以后就可以正常运行。
后期在继续抽取spring boot底层功能封装时,会从源码找到此问题发生的原因,并更新此文章
阅读全文
0 0
- spring-boot报错Exception encountered during context initialization
- Exception encountered during context initialization
- Exception encountered during context initialization
- 警告: Exception encountered during context initialization
- 警告: Exception encountered during context initialization
- tomcat启动出现 encountered during context initialization - cancelling refresh attempt异常
- 安装Maven报错:Network connection problems encountered during search
- spring Context initialization failed
- tomcat 报错:Error occurred during initialization of VM
- Oracle 报错 Process exited abnormally during initialization
- Tomcat启动报Error occurred during initialization of VM错
- SCCM:Setup has encountered fatal errors during database initialization.
- Spring Boot 工程启动报错"org.springframework.context.ApplicationContextException: Unable to start ..."解决方案
- 全局搜索的时候报错problems encountered during text search
- 全局搜索的时候报错problems encountered during text search
- 全局搜索的时候报错problems encountered during text search
- Android import和export使用说明 及 export报错:Problems were encountered during export解决
- myeclipse报错:Building workspace' has encountered a problem. Errors occurred during the build
- jsp自定义微信分享的标题,图片,摘要
- 类的初始化顺序(二)
- SURF算法解析
- js基础,点击换图片,带参数
- JavaScript table 序列化
- spring-boot报错Exception encountered during context initialization
- 每天一点ES6(三)
- Eclipse运行C++问题Launch failed,Binary not found
- bootstrap中怎么样使按钮居中
- Kotlin第二学
- webdriver中元素查找常用方法(全集)
- 注入的花式绕过姿势--向鸡哥学习
- 洛谷P2668 斗地主 贪心+搜索
- 手机音频调试工具