• 카테고리

    질문 & 답변
  • 세부 분야

    백엔드

  • 해결 여부

    미해결

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

23.12.13 15:45 작성 조회수 446

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는 위처럼 나왔습니다.

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

답변 1

답변을 작성해보세요.

0

y2gcoder님의 프로필

y2gcoder

2023.12.13

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

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

감사합니다.

S_now님의 프로필

S_now

질문자

2023.12.13

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관련 설정은 이것밖에 없습니다

y2gcoder님의 프로필

y2gcoder

2023.12.13

spring.datasource.username=sa

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

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

S_now님의 프로필

S_now

질문자

2023.12.13

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

y2gcoder님의 프로필

y2gcoder

2023.12.13

 

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

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

https://bit.ly/3fX6ygx


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


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

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

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


링크: 공식 서포터즈

링크: 자주하는 질문

감사합니다.

y2gcoder님의 프로필

y2gcoder

2023.12.14

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

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

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

image

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

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

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

 

S_now님의 프로필

S_now

질문자

2023.12.15

감사합니다!