다잘하고싶어

[에러]o.s.b.d.LoggingFailureAnalysisReporter 본문

카테고리 없음

[에러]o.s.b.d.LoggingFailureAnalysisReporter

챙영잉 2022. 10. 19. 23:21

프로젝트 과정에서 git에 merge한 파일을 풀 땡겨서 받아오고, 실행시키니 아래와 같은 에러가 났다.

 

2022-10-19 21:24:11.795  WARN 16647 --- [  restartedMain] ConfigServletWebServerApplicationContext : Exception encountered during context initialization 
- cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 
'dataSourceScriptDatabaseInitializer' defined in class path resource [org/springframework/boot/autoconfigure/sql/init/DataSourceInitializationConfiguration.class]: 
Unsatisfied dependency expressed through method 'dataSourceScriptDatabaseInitializer' 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$Hikari.class]: 
Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.zaxxer.hikari.HikariDataSource]:
Factory method 'dataSource' threw exception; nested exception is org.springframework.boot.autoconfigure.jdbc.DataSourceProperties$DataSourceBeanCreationException: 
Failed to determine a suitable driver class
2022-10-19 21:24:11.797  INFO 16647 --- [  restartedMain] o.apache.catalina.core.StandardService   : Stopping service [Tomcat]
2022-10-19 21:24:11.813  INFO 16647 --- [  restartedMain] ConditionEvaluationReportLoggingListener : 

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2022-10-19 21:24:11.822 ERROR 16647 --- [  restartedMain] o.s.b.d.LoggingFailureAnalysisReporter   : 

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


Process finished with exit code 0

콘솔창을 확인해보니 dataSourceScriptDatabaseInitializer 빈을 생성하는 데 실패했고,

그래서 datasource.url 관련된 에러가 난거였다. 

보통 이 문제라면 application.properties 파일에 datasource 관련된 설정을 추가해주면 된다.(url, username, password)

그런데 분명 application.properties에 datasource.url 을 설정해줬는데? 하면서 살펴보니

build에만 application.properties 파일이 있고, 아래 src 에는 그 파일이 없었던 것.

 

확인해보니 팀원이 merge 할 때 .gitignore를 추가해서 파일을 깃에 올렸기 때문에 

가장 최신상태의 main branch에는 application.properties 이 없는 상태로 올라와있었고,

나는 아직 .gitignore를 추가하지 않아서 풀 땡겨서 가져온 파일에는 application.properties이 없었던 거다.

따라서 application.properties이 없는 상태에서 프로젝트를 실행시켰으니 당연히 에러가 날 수 밖에 없었다!

 

팀원에서 application.properties파일을 받아서 src 폴더 안에 넣어주고, 

(나중을 위해 .gitignore 도 추가해준 뒤)

다시 실행시키니 정상적으로 잘 실행이 됐다!