Notice
Recent Posts
Recent Comments
Link
«   2025/01   »
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
Archives
Today
Total
관리 메뉴

집 짓는 개발블로그

[Spring boot + mongoDB] Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured. 에러 해결 본문

에러 로그

[Spring boot + mongoDB] Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured. 에러 해결

취준er 2024. 1. 27. 19:38

 

빠른 개발을 위해 익숙한 mysql을 사용하다가 mongoDB로 옮겨가는 과정에서 생긴 에러. 이전 프로젝트에서 Spring data Jpa로 mysql, Spring data mongoDB로 mongoDB를 조작했을 때는 문제가 없었다. 

***************************
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 1

 

jpa 때문인 것 같아서(직전 프로젝트와 달리 rdbms를 아예 사용하지 않으니) 남아있던 mysql, jpa 의존성을 삭제하고 applicaion.yml에서 jpa 관련 설정도 지웠지만 해결되지 않았다.

 

 

🎈 application.yml에 다음을 추가하니 해결되었다. 

spring:
  autoconfigure:
    exclude: org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration

 

참고: https://stackoverflow.com/questions/51221777/failed-to-configure-a-datasource-url-attribute-is-not-specified-and-no-embedd

 

Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured

I am working on a Spring Boot Batch example with MongoDB and I have already started the mongod server. When I launch my application, I am getting the error below. Any pointers for this issue? **...

stackoverflow.com

위 링크의 질문자는 spring batch 의존성을 추가한 상태인데, 답변을 보니 spring batch 자체가 jpa와 연관이 있어(?) 이런 문제가 발생했다고 한다.

내 프로젝트에도 spring batch 의존성이 추가되어 있다. 나중에 더 자세히 알아보면 좋을 것 같다.

ependencies {
	implementation 'org.springframework.boot:spring-boot-starter-batch'

	implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'
	implementation 'org.springframework.boot:spring-boot-starter-web'
	implementation 'org.springframework.boot:spring-boot-starter-webflux'
	compileOnly 'org.projectlombok:lombok'

	annotationProcessor 'org.projectlombok:lombok'
	testImplementation 'org.springframework.boot:spring-boot-starter-test'
	testImplementation 'io.projectreactor:reactor-test'
	testImplementation 'org.springframework.batch:spring-batch-test'

	implementation 'org.springframework.boot:spring-boot-starter-data-mongodb'
}