SpringBoot 를 Default 상태에서 ( 어떠한 설정 없이 ) Embedded Tomcat 구동 시 다음과 같은 오류가 발생될 수 있다. 

 

 *************************** 
 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
 (the profiles local are currently active).

 

오류 원인은 SpringBoot 내장 톰캣 구동 시  DB 연결 시도가 실패하여 발생되는 것이다. 

 

해결 방법은 2가지 이다. 

1. DB 연결 설정을 추가 또는 설정에 잘못된 부분이 있는지 확인한다.

2. DB 연결 Lib 를 제외하고 내장 톰캣을 수행한다. 

 

여기서는 DB 연결 없이 내장 톰캣 수행 방법을 기입해보겠다. 

 

우선 DB 을 위한 설정이 있다면 수행되지 않게 처리한다.

 

다음은 @SpringBootApplication 이 선언된 부분을 찾는다. 

 

그리고 다음과 같이 변경한다.


// @SpringBootApplication  // ( 기존 선언 주석처리 )
@SpringBootApplication ( exclude = {DataSourceAutoConfiguration.class} )

즉, 자동 DB 연결 class 를 제외하고 내장 톰캣을 구동하게 선언한 것이다. 

 

만약, SpringBoot 내장 톰캣 구동이 실패할 경우, 소스 내부적 또는 Properties 내에서 DB 연결 설정부분이 

있는지 찾아보기를 바란다.

+ Recent posts