1. 程式人生 > >spring-boot報錯Exception encountered during context initialization

spring-boot報錯Exception encountered during context initialization

今天準備把我之前搭建的,基於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 stopped 2017-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 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 (the profiles "dev,redis,config,mongodb,activemq,socketio" are currently active).

在多方查證後,需要在啟動類的@EnableAutoConfiguration或@SpringBootApplication中新增exclude = {DataSourceAutoConfiguration.class},排除此類的autoconfig。啟動以後就可以正常執行。
後期在繼續抽取spring boot底層功能封裝時,會從原始碼找到此問題發生的原因,並更新此文章

相關推薦

spring-bootException encountered during context initialization

今天準備把我之前搭建的,基於springboot的框架的基礎功能包抽離出來,在增加spring yml自定義設定後,在業務專案啟動時會報出以下異常。 2017-02-23 18:55:09.869 WARN main org.springframewor

Spring AOP Exception encountered during context initialization

三月 19, 2018 4:01:40 下午 org.springframework.context.support.AbstractApplicationContext prepareRefresh 資訊: Refreshing org[email protect

springmvc之JSR303驗證出現:警告: Exception encountered during context initialization - cancelling refresh at

昨晚在練習springmvc的JSR303資料驗證的時候,明明是跟著教程裡面走的,可是又出現了一個奇葩的問題: 警告: Exception encountered during context initialization - cancelling refresh attempt: org

警告: Exception encountered during context initialization

今天在練習搭建ssm框架的時候,報了這麼一個錯,沒遇見過有點蒙逼,檢查了所有的配置檔案,發現並沒有問題,於是將所有的controller和service刪掉重寫,並逐步檢查,最後找到問題所在:原來是我的service沒加註解,所以遇到同樣報錯的小夥伴,可以檢查一下自己的註解是

Exception encountered during context initialization

have different Class objects for the type org/slf4j/ILoggerFactory used in the signature slf4j 衝突

spring boot Exception in thread "main" java.lang.NoSuchMethodError 根源在pom.xml引用的包中的JAR有衝突

Exception in thread "main" java.lang.NoSuchMethodError 突然發現一個spring boot專案tomcat啟動不起來了。 目錄下:mvn dependency:tree 檢視是不是有依賴的JAR包有衝突了 重新一個

Spring Boot :Error creating bean with name 'entityManagerFactory' defined in class path resource

fine 依賴 debug isp jpa java idt .com ima spring boot 寫一個web項目,在使用spring-data-jpa的時候,啟動報如下錯誤: Error starting ApplicationContext. To display

Spring Boot 記錄

odi host localhost char jdb name pri exclude encoding Spring Boot 報錯記錄 由於新建的項目沒有配置數據庫連接啟動報錯,可以通過取消自動數據源自動配置來解決 解決方案1: @SpringBootAppli

Spring-boot集及解決方案

*************************** 申請未能開始******************* ********  描述:  無法配置DataSource:未指定'url'屬性,也無法配置嵌入資料來源。  原因:無法確定合適的驅動程式類   &n

Spring Boot:Whitelabel Error Page

今天在搭建Spring Boot專案的時候,在程式碼方面沒有任何錯誤的情況下,訪問頁面報了一個這樣的錯誤,一開始很費解,最後查閱文件,發現是因為我的Application啟動類的位置放錯了,一開始是這樣的: 但是當Application啟動的時候,Spring Boot會載入啟動類所在包下

spring boot (1)

The content of element type "configuration" must match "(properties?,settings?,typeAliases?,typeHandlers?,objectFactory?... 報錯 如圖: 百度搜

解決: Spring Boot This application has no explicit mapping ... a fallback

啟動spring boot然後訪問頁面的時候,出現如下錯誤: Whitelabel Error Page This application has no explicit mapping for /error, so you are seeing this as a fallback. Mo

spring boot Failed to read HTTP message

2008-12-13 15:06:03,930 WARN (DefaultHandlerExceptionResolver.java:384)- Failed to read HTTP message: org.springframework.http.converter.HttpMessageNotRead

spring Boot 之五種(不打包執行)

Whitelabel Error Page This application has no explicit mapping for /error, so you are seeing this as a fallback. Fri Aug 18 13:01:46

Spring-boot This application has no explicit mapping for /error, so you are seeing this as a fallb

This application has no explicit mapping for /error, so you are seeing this as a fallback. 在使用spring

Spring boot java.lang.NullPointerException: null

新學習  Spring boot  按照網上資料搭建(相容jsp),成功啟動,正常遇見 helloworld 但頁面一直不讓用EL表示式,報錯如下:java.lang.NullPointerException: null at javax.el.CompositeELRes

Spring Boot 啟動 Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: 37

work 結果 frame getc director inf 中文 getclass post 使用命令 java -jar springBoot.jar 啟動項目,結果報錯如下: Exception in thread "main" java.lang.String

sshclient上傳檔案encountered 1 errors during the transfer解決方法

encountered 1 errors during the transfer解決方案: 1.檢視要檔案目錄許可權,當前使用者對要上傳檔案的目錄 要有rwx許可權; 2.把伺服器上同名檔案先備份在上傳; 3.如果檔案在桌面上上傳不了,將要上傳的檔案複製到其它分割槽,再上

Spring BooUnable to start embedded container; nested exception is java.lang.NoSuchMethodError: org

轉載地址:https://www.cnblogs.com/wushuai2014/p/7497206.html 問題描述:通過Spring Boot官方提供的方式,寫出如下HelloWorld程式碼。 org.springframework.context.ApplicationContex

Spring Bootjava.lang.NoClassDefFoundError: javax/servlet/Filter這個啟動不了

Spring Boot報java.lang.NoClassDefFoundError: javax/servlet/Filter解決 解決方法: 註釋掉:《scope》provided《/scope》 <dependency> <group