inflearn logo
강의

강의

N
챌린지

챌린지

멘토링

멘토링

N
클립

클립

로드맵

로드맵

지식공유

스프링 입문 - 코드로 배우는 스프링 부트, 웹 MVC, DB 접근 기술

JPA

에러가 발생했는데 원인을 모르겠습니다.

668

S_now

작성한 질문수 2

0

학습하는 분들께 도움이 되고, 더 좋은 답변을 드릴 수 있도록 질문전에 다음을 꼭 확인해주세요.

1. 강의 내용과 관련된 질문을 남겨주세요.
2. 인프런의 질문 게시판과 자주 하는 질문(링크)을 먼저 확인해주세요.
(자주 하는 질문 링크: https://bit.ly/3fX6ygx)
3. 질문 잘하기 메뉴얼(링크)을 먼저 읽어주세요.
(질문 잘하기 메뉴얼 링크: https://bit.ly/2UfeqCG)

질문 시에는 위 내용은 삭제하고 다음 내용을 남겨주세요.
=========================================
[질문 템플릿]
1. 강의 내용과 관련된 질문인가요? (예/아니오)
2. 인프런의 질문 게시판과 자주 하는 질문에 없는 내용인가요? (예/아니오)
3. 질문 잘하기 메뉴얼을 읽어보셨나요? (예/아니오)

[질문 내용]
여기에 질문 내용을 남겨주세요.

java.lang.IllegalStateException: Failed to load ApplicationContext for [WebMergedContextConfiguration@545d2560 testClass = hello.spring.hello.service.MemberServiceIntegrationTest, locations = [], classes = [hello.spring.hello.HelloApplication], contextInitializerClasses = [], activeProfiles = [], propertySourceDescriptors = [], propertySourceProperties = ["org.springframework.boot.test.context.SpringBootTestContextBootstrapper=true"], contextCustomizers = [org.springframework.boot.test.autoconfigure.actuate.observability.ObservabilityContextCustomizerFactory$DisableObservabilityContextCustomizer@1f, org.springframework.boot.test.autoconfigure.properties.PropertyMappingContextCustomizer@0, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverContextCustomizer@61001b64, org.springframework.boot.test.context.filter.ExcludeFilterContextCustomizer@4b8ee4de, org.springframework.boot.test.json.DuplicateJsonObjectContextCustomizerFactory$DuplicateJsonObjectContextCustomizer@4659191b, org.springframework.boot.test.mock.mockito.MockitoContextCustomizer@0, org.springframework.boot.test.web.client.TestRestTemplateContextCustomizer@3527942a, org.springframework.boot.test.context.SpringBootTestAnnotation@5891170b], resourceBasePath = "src/main/webapp", contextLoader = org.springframework.boot.test.context.SpringBootContextLoader, parent = null]

테스트 실행시 이런 오류가 발생했습니다.

Caused by: org.hibernate.HibernateException: Unable to determine Dialect without JDBC metadata (please set 'javax.persistence.jdbc.url', 'hibernate.connection.url', or 'hibernate.dialect')

caused by는 위처럼 나왔습니다.

설정의 오류인것 같은데 무슨 설정의 오류인지 모르겠고 어떻게 설정해줘야 하는지 모르겠습니다.

java spring mvc spring-boot

답변 1

0

y2gcoder

안녕하세요. S_now님, 공식 서포터즈 y2gcoder입니다.

h2 DB가 실행 중인지 확인해주십쇼 :)
실행 중이라면 설정 파일 전체를 보여주시겠습니까?

감사합니다.

1

S_now

h2 DB는 실행중입니다!

//application.properties

spring.datasource.url=jdbc:h2:tcp://localhost/~/test
spring.datasource.driver-class-name=org.h2.Driver
spring.jpa.show-sql=true
spring.jpa.hibernate.ddl-auto=none

//build.gradle
plugins {
	id 'java'
	id 'org.springframework.boot' version '3.2.0'
	id 'io.spring.dependency-management' version '1.1.4'
}

group = 'hello.spring'
version = '0.0.1-SNAPSHOT'

java {
	sourceCompatibility = '17'
}

repositories {
	mavenCentral()
}

dependencies {
	implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'
	implementation 'org.springframework.boot:spring-boot-starter-web'
//	implementation 'org.springframework.boot:spring-boot-starter-jdbc'
	implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
	runtimeOnly 'com.h2database:h2'
	testImplementation ('org.springframework.boot:spring-boot-starter-test'){
		exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
	}
}

test{
	useJUnitPlatform()
}

db관련 설정은 이것밖에 없습니다

0

y2gcoder

spring.datasource.username=sa

을 설정 파일에 추가해보시겠습니까?

image본 강의 자료 pdf 기준 51, 52페이지 내용입니다 :) 혹시 강의 자료가 최신이 아니라면 최신 문서를 다시 받아서 확인해주십쇼!

1

S_now

추가해보았지만 해결되지 않았습니다.ㅠㅠ

0

y2gcoder

 

실제 동작하는 전체 프로젝트를 압축해서 구글 드라이브로 공유해서 링크를 남겨주세요.

구글 드라이브 업로드 방법은 다음을 참고해주세요.

https://bit.ly/3fX6ygx


주의: 업로드시 링크에 있는 권한 문제 꼭 확인해주세요


추가로 다음 내용도 코멘트 부탁드립니다.

1. 문제 영역을 실행할 수 있는 방법

2. 문제가 어떻게 나타나는지에 대한 상세한 설명


링크: 공식 서포터즈

링크: 자주하는 질문

감사합니다.

1

S_now

https://drive.google.com/file/d/1vehEp4gocjcQjBg3cxm4u6nWMYqPdznD/view?usp=drive_link
감사합니다!

1

y2gcoder

보내주신 코드 살펴보았습니다!

질문 이후로 학습을 더 이어나가셨군요!

먼저 받은 후 간단하게 MemberServiceIntegrationTest를 돌려봤습니다!

image

순환 의존성이 있다고 에러가 나옵니다!

image강의와 다르게 SpringConfig에 TimeTraceAop() 를 추가해주셨습니다. 제거해주십쇼!

image그리고 나서 테스트를 돌리니 성공했습니다! ㅎㅎ

 

1

S_now

감사합니다!

..

0

76

2

Unused property.....

0

101

2

project JDK is misconfigured

0

132

2

외부 API의 ID 타입(String/UUID)과 내부 도메인의 ID 타입(Long)이 불일치할 때의 설계 정석

0

83

2

단위/통합 테스트 버전충돌 문제

0

91

2

❗️springboot 4.0.2 버전 aspectj dependency 설정❗️

0

230

1

왜 컨트롤러는 변한게 없는데 새로 만든 html 파일이 뜨나요?

0

104

2

윈도우 build test오류 질문

1

102

2

테스트 관련 공부에 대한 조언을 얻고 싶습니다

0

101

2

테스트 실행 시 에러 질문

0

292

1

name을 통한 비교와 객체를 통한 비교

0

77

1

빌드 후 libs 없음

1

129

1

윈도우 gradlew.bat 에러

0

167

1

@PostMapping("/members/new")가 동작하지 않습니다

0

89

1

java static class와 kotlin class

0

79

1

스프링 DB연결

0

126

1

소요 시간

0

87

2

ddl.sql에 빨간 밑줄

1

102

2

welcome page 에러

0

183

3

잘 모르겠습니다.

0

164

2

fail을 똑같이 쳤는데 오류가 발생해요

0

156

2

index.html Welcome page

0

124

1

프로젝트 gradle-groovy ?

0

369

1

테스트코드 메서드명 한글

0

202

2