안녕하세요, 이번 글에서는 스프링 부트 + Gradle + JPA 프로젝트를 진행하다 발생한
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 오류 해결 방법을 다룹니다.
이미 포스팅한 적이 있으니 아래 게시글에 적힌 방법으로도 해결이 되지 않으신 분들께 열람을 권합니다.
[Spring Boot] Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured.
안녕하세요, 이번 글에서는 스프링 부트 프로젝트에서 기본 주소를 요청하는 법을 진행하다 발생한 Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured. Rea
mnoqc.tistory.com
이번 게시글에서 해결한 오류는 총 3개입니다.
1. 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
해결: yml 파일에서는 들여쓰기를 통하여 계층 간의 구조를 나타냅니다. 꼼꼼하게 확인해 줍니다.
그런데, 해당 오류를 해결하니 또 다른 오류가 발생했습니다.
2. Cannot load driver class: com.mysql.cj.jdbc.Driver (빨간 줄)
해결: 'mysql:mysql-connector-j' 또는 'mysql:mysql-connector-java' 부분에 버전 정보를 명시해 줍니다.
'mysql:mysql-connector-java:(버전 정보)'
runtimeOnly 'mysql:mysql-connector-java:8.0.31'
JDBC 드라이버 문제를 해결하고 나니 콘솔창에 또 다른 오류가 발생했습니다.
3. org.hibernate.boot.registry.selector.spi.StrategySelectionException: Unable to resolve name [org.hibernate.dialect.MySQL5InnoDBDialect] as strategy [org.hibernate.dialect.Dialect]
해결: yml 파일에서 jpa 설정을 수정해 줍니다.
database-platform: org.hibernate.dialect.MySQL5InnoDBDialect 부분을
database-platform: org.hibernate.dialect.MySQLDialect 로 변경해 줍니다.
Hibernate 6부터는 버전 검색을 하지 않아도 실행이 가능하다고 합니다.
https://docs.jboss.org/hibernate/orm/6.0/migration-guide/migration-guide.html#_dialects
6.0 Migration Guide
As back-ground, Hibernate does understand whether a fetch is actually, truly circular. It simply understands that while walking a fetch-graph it encounters the same table/column(s) making up a particular foreign-key. In this case, it simply stops walking t
docs.jboss.org
jpa:
database-platform: org.hibernate.dialect.MySQLDialect
'BackEnd > Spring Boot' 카테고리의 다른 글
[Spring Boot] 스프링 부트로 회원 관리하기 (9) 로그인 구현하기 (0) | 2024.05.16 |
---|---|
[Spring Boot] 스프링 부트로 회원 관리하기 (8) 회원가입 완료하기 (0) | 2024.05.15 |
[Spring Boot] 스프링 부트로 회원 관리하기 (7) 회원가입 DB 연동하기 2 (0) | 2024.05.15 |
[Spring Boot] 스프링 부트로 회원 관리하기 (6) 회원가입 DB 연동하기 1 (0) | 2024.05.14 |
[Spring Boot] 스프링 부트로 회원 관리하기 (5) 회원가입 페이지 요청하기 (0) | 2024.05.14 |