inflearn logo
강의

강의

N
챌린지

챌린지

멘토링

멘토링

N
클립

클립

로드맵

로드맵

지식공유

실전! 스프링 부트와 JPA 활용1 - 웹 애플리케이션 개발

JPA와 DB 설정, 동작확인

Member테이블 생성이 안되는데 어떤 문제일까요?

480

지수나

작성한 질문수 2

0

문법적 오류는 아닌 거 같습니다

테스트 돌려보면 이렇게 나오는데

원인이 뭘까요 똑같이 따라했는데 ㅠㅠ

Testing started at 오후 2:17 ...

> Task :cleanTest

> Task :compileJava UP-TO-DATE

> Task :processResources

> Task :classes

> Task :compileTestJava UP-TO-DATE

> Task :processTestResources NO-SOURCE

> Task :testClasses UP-TO-DATE

> Task :test

14:17:42.173 [Test worker] DEBUG org.springframework.test.context.junit4.SpringJUnit4ClassRunner - SpringJUnit4ClassRunner constructor called with [class jpabook.jpashop.MemberRepositoryTest]

14:17:42.189 [Test worker] DEBUG org.springframework.test.context.BootstrapUtils - Instantiating CacheAwareContextLoaderDelegate from class [org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate]

14:17:42.206 [Test worker] DEBUG org.springframework.test.context.BootstrapUtils - Instantiating BootstrapContext using constructor [public org.springframework.test.context.support.DefaultBootstrapContext(java.lang.Class,org.springframework.test.context.CacheAwareContextLoaderDelegate)]

14:17:42.252 [Test worker] DEBUG org.springframework.test.context.BootstrapUtils - Instantiating TestContextBootstrapper for test class [jpabook.jpashop.MemberRepositoryTest] from class [org.springframework.boot.test.context.SpringBootTestContextBootstrapper]

14:17:42.287 [Test worker] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Neither @ContextConfiguration nor @ContextHierarchy found for test class [jpabook.jpashop.MemberRepositoryTest], using SpringBootContextLoader

14:17:42.294 [Test worker] DEBUG org.springframework.test.context.support.AbstractContextLoader - Did not detect default resource location for test class [jpabook.jpashop.MemberRepositoryTest]: class path resource [jpabook/jpashop/MemberRepositoryTest-context.xml] does not exist

14:17:42.295 [Test worker] DEBUG org.springframework.test.context.support.AbstractContextLoader - Did not detect default resource location for test class [jpabook.jpashop.MemberRepositoryTest]: class path resource [jpabook/jpashop/MemberRepositoryTestContext.groovy] does not exist

14:17:42.296 [Test worker] INFO org.springframework.test.context.support.AbstractContextLoader - Could not detect default resource locations for test class [jpabook.jpashop.MemberRepositoryTest]: no resource found for suffixes {-context.xml, Context.groovy}.

14:17:42.297 [Test worker] INFO org.springframework.test.context.support.AnnotationConfigContextLoaderUtils - Could not detect default configuration classes for test class [jpabook.jpashop.MemberRepositoryTest]: MemberRepositoryTest does not declare any static, non-private, non-final, nested classes annotated with @Configuration.

14:17:42.412 [Test worker] DEBUG org.springframework.test.context.support.ActiveProfilesUtils - Could not find an 'annotation declaring class' for annotation type [org.springframework.test.context.ActiveProfiles] and class [jpabook.jpashop.MemberRepositoryTest]

14:17:42.591 [Test worker] DEBUG org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider - Identified candidate component class: file [C:\Users\Toshiba\Desktop\study\jpashop\jpashop\build\classes\java\main\jpabook\jpashop\JpashopApplication.class]

14:17:42.605 [Test worker] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Found @SpringBootConfiguration jpabook.jpashop.JpashopApplication for test class jpabook.jpashop.MemberRepositoryTest

14:17:42.841 [Test worker] DEBUG org.springframework.boot.test.context.SpringBootTestContextBootstrapper - @TestExecutionListeners is not present for class [jpabook.jpashop.MemberRepositoryTest]: using defaults.

14:17:42.844 [Test worker] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Loaded default TestExecutionListener class names from location [META-INF/spring.factories]: [org.springframework.boot.test.autoconfigure.restdocs.RestDocsTestExecutionListener, org.springframework.boot.test.autoconfigure.web.client.MockRestServiceServerResetTestExecutionListener, org.springframework.boot.test.autoconfigure.web.servlet.MockMvcPrintOnlyOnFailureTestExecutionListener, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverTestExecutionListener, org.springframework.boot.test.mock.mockito.MockitoTestExecutionListener, org.springframework.boot.test.mock.mockito.ResetMocksTestExecutionListener, org.springframework.test.context.web.ServletTestExecutionListener, org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener, org.springframework.test.context.support.DependencyInjectionTestExecutionListener, org.springframework.test.context.support.DirtiesContextTestExecutionListener, org.springframework.test.context.transaction.TransactionalTestExecutionListener, org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener]

14:17:42.896 [Test worker] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Using TestExecutionListeners: [org.springframework.test.context.web.ServletTestExecutionListener@27c8f2ae, org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener@293327b4, org.springframework.boot.test.mock.mockito.MockitoTestExecutionListener@57cf5589, org.springframework.boot.test.autoconfigure.SpringBootDependencyInjectionTestExecutionListener@7e97c13e, org.springframework.test.context.support.DirtiesContextTestExecutionListener@1eaa11c0, org.springframework.test.context.transaction.TransactionalTestExecutionListener@2e949b26, org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener@3dae060, org.springframework.boot.test.autoconfigure.restdocs.RestDocsTestExecutionListener@43844f14, org.springframework.boot.test.autoconfigure.web.client.MockRestServiceServerResetTestExecutionListener@dee62b5, org.springframework.boot.test.autoconfigure.web.servlet.MockMvcPrintOnlyOnFailureTestExecutionListener@7299585, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverTestExecutionListener@5324ace0, org.springframework.boot.test.mock.mockito.ResetMocksTestExecutionListener@3239a57f]

14:17:42.906 [Test worker] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved @ProfileValueSourceConfiguration [null] for test class [jpabook.jpashop.MemberRepositoryTest]

14:17:42.907 [Test worker] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved ProfileValueSource type [class org.springframework.test.annotation.SystemProfileValueSource] for class [jpabook.jpashop.MemberRepositoryTest]

14:17:42.920 [Test worker] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved @ProfileValueSourceConfiguration [null] for test class [jpabook.jpashop.MemberRepositoryTest]

14:17:42.921 [Test worker] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved ProfileValueSource type [class org.springframework.test.annotation.SystemProfileValueSource] for class [jpabook.jpashop.MemberRepositoryTest]

14:17:42.924 [Test worker] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved @ProfileValueSourceConfiguration [null] for test class [jpabook.jpashop.MemberRepositoryTest]

14:17:42.925 [Test worker] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved ProfileValueSource type [class org.springframework.test.annotation.SystemProfileValueSource] for class [jpabook.jpashop.MemberRepositoryTest]

14:17:42.938 [Test worker] DEBUG org.springframework.test.context.support.AbstractDirtiesContextTestExecutionListener - Before test class: context [DefaultTestContext@255eec38 testClass = MemberRepositoryTest, testInstance = [null], testMethod = [null], testException = [null], mergedContextConfiguration = [WebMergedContextConfiguration@426dab4d testClass = MemberRepositoryTest, locations = '{}', classes = '{class jpabook.jpashop.JpashopApplication}', contextInitializerClasses = '[]', activeProfiles = '{}', propertySourceLocations = '{}', propertySourceProperties = '{org.springframework.boot.test.context.SpringBootTestContextBootstrapper=true}', contextCustomizers = set[org.springframework.boot.test.autoconfigure.properties.PropertyMappingContextCustomizer@0, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverContextCustomizerFactory$Customizer@17a6614d, org.springframework.boot.test.context.filter.ExcludeFilterContextCustomizer@7f4ad5d4, org.springframework.boot.test.json.DuplicateJsonObjectContextCustomizerFactory$DuplicateJsonObjectContextCustomizer@6e1f7f82, org.springframework.boot.test.mock.mockito.MockitoContextCustomizer@0, org.springframework.boot.test.web.client.TestRestTemplateContextCustomizer@31d979ab], resourceBasePath = 'src/main/webapp', contextLoader = 'org.springframework.boot.test.context.SpringBootContextLoader', parent = [null]], attributes = map['org.springframework.test.context.web.ServletTestExecutionListener.activateListener' -> true]], class annotated with @DirtiesContext [false] with mode [null].

14:17:42.940 [Test worker] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved @ProfileValueSourceConfiguration [null] for test class [jpabook.jpashop.MemberRepositoryTest]

14:17:42.940 [Test worker] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved ProfileValueSource type [class org.springframework.test.annotation.SystemProfileValueSource] for class [jpabook.jpashop.MemberRepositoryTest]

14:17:42.996 [Test worker] DEBUG org.springframework.test.context.support.TestPropertySourceUtils - Adding inlined properties to environment: {spring.jmx.enabled=false, org.springframework.boot.test.context.SpringBootTestContextBootstrapper=true, server.port=-1}

  .   ____          _            __ _ _

 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \

( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \

 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )

  '  |____| .__|_| |_|_| |_\__, | / / / /

 =========|_|==============|___/=/_/_/_/

 :: Spring Boot ::       (v2.1.11.RELEASE)

2020-01-03 14:17:44.047  INFO 5780 --- [    Test worker] jpabook.jpashop.MemberRepositoryTest     : Starting MemberRepositoryTest on DESKTOP-N953KG9 with PID 5780 (started by Toshiba in C:\Users\Toshiba\Desktop\study\jpashop\jpashop)

2020-01-03 14:17:44.051  INFO 5780 --- [    Test worker] jpabook.jpashop.MemberRepositoryTest     : No active profile set, falling back to default profiles: default

2020-01-03 14:17:46.496  INFO 5780 --- [    Test worker] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFAULT mode.

2020-01-03 14:17:46.565  INFO 5780 --- [    Test worker] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 39ms. Found 0 JPA repository interfaces.

2020-01-03 14:17:47.607  INFO 5780 --- [    Test worker] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration$$EnhancerBySpringCGLIB$$108b6778] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)

2020-01-03 14:17:48.112  INFO 5780 --- [    Test worker] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Starting...

2020-01-03 14:17:48.595  INFO 5780 --- [    Test worker] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Start completed.

2020-01-03 14:17:48.836  INFO 5780 --- [    Test worker] o.hibernate.jpa.internal.util.LogHelper  : HHH000204: Processing PersistenceUnitInfo [

name: default

...]

2020-01-03 14:17:49.074  INFO 5780 --- [    Test worker] org.hibernate.Version                    : HHH000412: Hibernate Core {5.3.14.Final}

2020-01-03 14:17:49.079  INFO 5780 --- [    Test worker] org.hibernate.cfg.Environment            : HHH000206: hibernate.properties not found

2020-01-03 14:17:49.511  INFO 5780 --- [    Test worker] o.hibernate.annotations.common.Version   : HCANN000001: Hibernate Commons Annotations {5.0.4.Final}

2020-01-03 14:17:49.966  INFO 5780 --- [    Test worker] org.hibernate.dialect.Dialect            : HHH000400: Using dialect: org.hibernate.dialect.H2Dialect

2020-01-03 14:17:51.741  INFO 5780 --- [    Test worker] o.h.t.schema.internal.SchemaCreatorImpl  : HHH000476: Executing import script 'org.hibernate.tool.schema.internal.exec.ScriptSourceInputNonExistentImpl@28d906ad'

2020-01-03 14:17:51.748  INFO 5780 --- [    Test worker] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'

2020-01-03 14:17:53.457  INFO 5780 --- [    Test worker] o.s.s.concurrent.ThreadPoolTaskExecutor  : Initializing ExecutorService 'applicationTaskExecutor'

2020-01-03 14:17:53.621  WARN 5780 --- [    Test worker] aWebConfiguration$JpaWebMvcConfiguration : spring.jpa.open-in-view is enabled by default. Therefore, database queries may be performed during view rendering. Explicitly configure spring.jpa.open-in-view to disable this warning

2020-01-03 14:17:53.766  INFO 5780 --- [    Test worker] o.s.b.a.w.s.WelcomePageHandlerMapping    : Adding welcome page: class path resource [static/index.html]

2020-01-03 14:17:54.824  INFO 5780 --- [    Test worker] jpabook.jpashop.MemberRepositoryTest     : Started MemberRepositoryTest in 11.803 seconds (JVM running for 15.878)

2020-01-03 14:17:55.128  INFO 5780 --- [    Test worker] o.s.t.c.transaction.TransactionContext   : Began transaction (1) for test context [DefaultTestContext@255eec38 testClass = MemberRepositoryTest, testInstance = jpabook.jpashop.MemberRepositoryTest@5dafbf92, testMethod = testMember@MemberRepositoryTest, testException = [null], mergedContextConfiguration = [WebMergedContextConfiguration@426dab4d testClass = MemberRepositoryTest, locations = '{}', classes = '{class jpabook.jpashop.JpashopApplication}', contextInitializerClasses = '[]', activeProfiles = '{}', propertySourceLocations = '{}', propertySourceProperties = '{org.springframework.boot.test.context.SpringBootTestContextBootstrapper=true}', contextCustomizers = set[org.springframework.boot.test.autoconfigure.properties.PropertyMappingContextCustomizer@0, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverContextCustomizerFactory$Customizer@17a6614d, org.springframework.boot.test.context.filter.ExcludeFilterContextCustomizer@7f4ad5d4, org.springframework.boot.test.json.DuplicateJsonObjectContextCustomizerFactory$DuplicateJsonObjectContextCustomizer@6e1f7f82, org.springframework.boot.test.mock.mockito.MockitoContextCustomizer@0, org.springframework.boot.test.web.client.TestRestTemplateContextCustomizer@31d979ab], resourceBasePath = 'src/main/webapp', contextLoader = 'org.springframework.boot.test.context.SpringBootContextLoader', parent = [null]], attributes = map['org.springframework.test.context.web.ServletTestExecutionListener.activateListener' -> true, 'org.springframework.test.context.web.ServletTestExecutionListener.populatedRequestContextHolder' -> true, 'org.springframework.test.context.web.ServletTestExecutionListener.resetRequestContextHolder' -> true]]; transaction manager [org.springframework.orm.jpa.JpaTransactionManager@24bf3512]; rollback [true]

2020-01-03 14:17:55.760  INFO 5780 --- [    Test worker] o.s.t.c.transaction.TransactionContext   : Rolled back transaction for test: [DefaultTestContext@255eec38 testClass = MemberRepositoryTest, testInstance = jpabook.jpashop.MemberRepositoryTest@5dafbf92, testMethod = testMember@MemberRepositoryTest, testException = [null], mergedContextConfiguration = [WebMergedContextConfiguration@426dab4d testClass = MemberRepositoryTest, locations = '{}', classes = '{class jpabook.jpashop.JpashopApplication}', contextInitializerClasses = '[]', activeProfiles = '{}', propertySourceLocations = '{}', propertySourceProperties = '{org.springframework.boot.test.context.SpringBootTestContextBootstrapper=true}', contextCustomizers = set[org.springframework.boot.test.autoconfigure.properties.PropertyMappingContextCustomizer@0, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverContextCustomizerFactory$Customizer@17a6614d, org.springframework.boot.test.context.filter.ExcludeFilterContextCustomizer@7f4ad5d4, org.springframework.boot.test.json.DuplicateJsonObjectContextCustomizerFactory$DuplicateJsonObjectContextCustomizer@6e1f7f82, org.springframework.boot.test.mock.mockito.MockitoContextCustomizer@0, org.springframework.boot.test.web.client.TestRestTemplateContextCustomizer@31d979ab], resourceBasePath = 'src/main/webapp', contextLoader = 'org.springframework.boot.test.context.SpringBootContextLoader', parent = [null]], attributes = map['org.springframework.test.context.web.ServletTestExecutionListener.activateListener' -> true, 'org.springframework.test.context.web.ServletTestExecutionListener.populatedRequestContextHolder' -> true, 'org.springframework.test.context.web.ServletTestExecutionListener.resetRequestContextHolder' -> true]]

2020-01-03 14:17:55.791  INFO 5780 --- [       Thread-5] o.s.s.concurrent.ThreadPoolTaskExecutor  : Shutting down ExecutorService 'applicationTaskExecutor'

2020-01-03 14:17:55.793  INFO 5780 --- [       Thread-5] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default'

2020-01-03 14:17:55.794  INFO 5780 --- [       Thread-5] .SchemaDropperImpl$DelayedDropActionImpl : HHH000477: Starting delayed evictData of schema as part of SessionFactory shut-down'

2020-01-03 14:17:56.045  WARN 5780 --- [       Thread-5] o.s.b.f.support.DisposableBeanAdapter    : Invocation of destroy method failed on bean with name 'inMemoryDatabaseShutdownExecutor': org.h2.jdbc.JdbcSQLNonTransientConnectionException: Database is already closed (to disable automatic closing at VM shutdown, add ";DB_CLOSE_ON_EXIT=FALSE" to the db URL) [90121-200]

2020-01-03 14:17:56.045  INFO 5780 --- [       Thread-5] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Shutdown initiated...

2020-01-03 14:17:56.064  INFO 5780 --- [       Thread-5] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Shutdown completed.

BUILD SUCCESSFUL in 20s

5 actionable tasks: 3 executed, 2 up-to-date

오후 2:17:56: Tasks execution finished ':cleanTest :test --tests "jpabook.jpashop.MemberRepositoryTest.testMember"'.

spring-boot spring 웹앱 java JPA

답변 2

3

김영한

안녕하세요. 지수나님

gradle을 통해서 실행이 되었네요. 최근 intellij 버전이 업그레이드 되면서 기본 값이 변경되었습니다.

다음을 참고하셔서 Build and run using과 Run tests using를 IntelliJ IDEA로 변경해주세요.

이렇게 설정하고 다시 실행해보세요^^

그리고 혹시 안되면 답글 남겨주세요

감사합니다.

0

dododo

안녕하세요, 김영한 선생님~ 혹시 해당 설정을 변경하면 무엇이 달라져서 적용이 되는 건 지 여쭤봐도 될까요?

0

김영한

안녕하세요. something do님

해당 설정과 실제 동작은 관계가 없습니다. 어떻게 설정하든 결과는 동일해야 합니다.

다만 이렇게 답변 드린 이유는 저와 같은 환경을 맞추고 그 다음에 나오는 오류 메시지를 남겨주시기를 기대했는데, 질문자 분께서 답변을 남겨주시 않으셨습니다.

감사합니다.

sdk 설정 오류

0

50

2

오탈자 - @Transactional

0

55

1

src/test/resources 테스트 경로 문제

0

50

1

상품 등록후 H2 db 출력 순서 바꿀 수 있나요?

0

64

1

MemberRepositoryTest 실행오류

0

81

1

boot 4.x >>> trasasction rolled back log & p6spy(영한님, 수업 자료 업데이트 해주시면 감사하겠습니다!!)

1

183

2

강의 마지막 QueryDSL 사용 부분 질문있습니다

1

138

2

클라이언트에서 isbn과 author 수정 요청을 한 경우에 대해 질문드립니다.

0

51

1

도메인 모델 패턴 vs 트랜잭션 스크립트 패턴

0

71

1

기본 생성자

0

60

1

h2 DB 연결시 jdbc url 변경 이유가 궁금합니다.

0

100

1

멤버서비스테스트 부분에서 막힙니다.

0

164

4

실무에서도 EntityManager를 이용해서 많이 작업하는 편일까요?

0

116

1

초반에 h2 다운로드 과정 꼭 필요한가요?

0

118

2

자신 필드에도 get으로 접근하는 이유가 있을까요?

0

113

1

24분 27초 연관관계 편의 메서드 위치

0

113

1

단건 주문만 가능하게 한건 의도한 부분이신가요?

0

108

2

빌드 툴, Gradle

0

59

1

h2연결은 된 것 같은데 엔티티 테이블까지 작성 후 확인해보아도 테이블이 안보입니다

0

76

2

Repository에서 EntityManager 주입 방식 차이

0

88

1

롬복과 사용자 정의 setter 메서드

0

71

1

주문 목록 조회 fetch join 질문드립니다

0

81

1

dirty checking 질문드립니다.

0

81

1

동시성 관련 질문입니다

0

74

1