inflearn logo
강의

강의

N
챌린지

챌린지

멘토링

멘토링

N
클립

클립

로드맵

로드맵

지식공유

스프링 오류 질문드립니다.

해결된 질문

305

whdk333

작성한 질문수 31

0

package jpabook.jpashop;

import org.assertj.core.api.Assertions;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.annotation.Rollback;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.transaction.annotation.Transactional;

@RunWith(SpringRunner.class)
@SpringBootTest
public class MemberRepositoryTest {
    @Autowired MemberRepository memberRepository;
    @Test
    @Transactional
    @Rollback(false)
    public void testMember() {
        Member member = new Member();
        member.setUsername("memberA");
        Long savedId = memberRepository.save(member);
        Member findMember = memberRepository.find(savedId);
        Assertions.assertThat(findMember.getId()).isEqualTo(member.getId());

        Assertions.assertThat(findMember.getUsername()).isEqualTo(member.getUsername());
        Assertions.assertThat(findMember).isEqualTo(member); //JPA 엔티티 동일성 보장
    }
}

위의 코드를 실행했는데, 아래와 같은 오류가 나왔습니다. 해결책을 알려주시면 감사하겠습니다.

 

 

... 91 common frames omitted

============================

CONDITIONS EVALUATION REPORT

============================

Positive matches:

-----------------

None

Negative matches:

-----------------

None

Exclusions:

-----------

None

Unconditional classes:

----------------------

None

2024-04-17T00:07:39.846+09:00 WARN 5176 --- [ Test worker] o.s.test.context.TestContextManager : Caught exception while allowing TestExecutionListener [org.springframework.test.context.web.ServletTestExecutionListener] to prepare test instance [jpabook.jpashop.MemberRepositoryTest@41a23470]

java.lang.IllegalStateException: Failed to load ApplicationContext for [WebMergedContextConfiguration@48368a08 testClass = jpabook.jpashop.MemberRepositoryTest, locations = [], classes = [jpabook.jpashop.JpashopApplication], 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@49cb9cb5, org.springframework.boot.test.context.filter.ExcludeFilterContextCustomizer@146587a2, org.springframework.boot.test.json.DuplicateJsonObjectContextCustomizerFactory$DuplicateJsonObjectContextCustomizer@16c63f5, org.springframework.boot.test.mock.mockito.MockitoContextCustomizer@0, org.springframework.boot.test.web.client.TestRestTemplateContextCustomizer@6127a7e, org.springframework.boot.test.context.SpringBootTestAnnotation@8694b330], resourceBasePath = "src/main/webapp", contextLoader = org.springframework.boot.test.context.SpringBootContextLoader, parent = null]

... 55 more

Caused by: org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment] due to: Unable to determine Dialect without JDBC metadata (please set 'jakarta.persistence.jdbc.url' for common cases or 'hibernate.dialect' when a custom Dialect implementation must be provided)

 

> Task :test FAILED

MemberRepositoryTest > testMember FAILED

java.lang.IllegalStateException at DefaultCacheAwareContextLoaderDelegate.java:180

Caused by: org.springframework.beans.factory.BeanCreationException at AbstractAutowireCapableBeanFactory.java:1786

Caused by: org.hibernate.service.spi.ServiceException at AbstractServiceRegistryImpl.java:276

Caused by: org.hibernate.HibernateException at DialectFactoryImpl.java:191

1 test completed, 1 failed

FAILURE: Build failed with an exception.

* What went wrong:

Execution failed for task ':test'.

> There were failing tests. See the report at: file:///C:/study/jpashop/build/reports/tests/test/index.html

* Try:

> Run with --scan to get full insights.

Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

For more on this, please refer to https://docs.gradle.org/8.7/userguide/command_line_interface.html#sec:command_line_warnings in the Gradle documentation.

BUILD FAILED in 6s

4 actionable tasks: 1 executed, 3 up-to-date

 

김영한강사님 스프링 spring 강의 오류 error

답변 1

1

OMG

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

h2가 실행중인 상태가 맞을까요?

h2를 실행하고 확인해보시겠어요?

해결이 안될 경우 댓글 남겨주세요

감사합니다.

0

whdk333

경로를 다르게 지정해서 생긴 오류였습니다. 감사합니다.

중복내용 제보?!

1

20

2

여러 파드 환경에서 단일 실행 보장 방식

0

24

2

패키지 구분에 대해 궁금한게 있습니다

0

25

2

코드 자료

0

50

2

조회속도 개선에서 더 개선하는 방법이 궁금합니다.

0

40

2

servlet과 container에 대한 질문입니다

0

29

1

RepositoryTest의 패키지 위치가 domain인 이유

0

36

2

도메인 모델에서 관계와 규칙을 구분하는 방법

0

49

2

23강 캘린더 화면 실습 강의 2가지 질문

0

38

1

UserService, CertificationService 책임 분리 기준 질문

0

28

1

spring initialiser 어떤걸 선택해야될지 모르겠어요

0

38

2

구현체가 동적으로 정해질 때, 팩토리 기법을 사용하나요?

0

56

2

Json 요청 처리

1

40

2

로그아웃-logout()-2 강에서 겟방식 로그아웃 호출 후 화면이동 질문입니다.

0

28

2

Build 관련 문제 (테스트 관련 문제)

0

44

2

job, step execution 관련 질문 드립니다.

0

44

2

이미지 업로드와 db 트랜잭션 묶는법

0

46

1

sdk 설정 오류

0

53

2

Orchestration SAGA 패턴 보상에 대한 질문입니다.

0

53

2

[건의][6장][작전1] deprecated 메소드

1

50

2

[예제][3장][작전2] windows 에서 마지막 예제

0

41

1

NaverBookRepository.class 의 위치에 따른 모듈간의 의존성에 대해 질문드립니다.

1

38

2

Could not resolve org.springframework.boot:spring-boot-starter-validation:2.4.4

0

55

2

REQUIRES_NEW 해결 방법에 대해서 질문있습니다!!

0

31

1