jojoldu / freelec-springboot2-webservice

1.07k stars 464 forks source link

[오류] p.297 BaseTimeEntity_등록만 FAILED 뜹니다.(해결완료, git에 누락된 파일이 존재하였고 다시 push하고 진행하니 작동, 그러나 잘 모르겠음) #882

Open yeojinha opened 1 year ago

yeojinha commented 1 year ago

기존에 올라온 질문이 아닌지 먼저 검색해주세요!

가장 자주 나온 제보

어떤 오류인가요?

오류설명: BaseTimeEntity_post FAILED 이 부분만 오류가 뜹니다 교재상에서는 PostsRepositoryTest의 BaseTimeEntity_등록에 해당합니다.

Task :compileJava Note: /home/ec2-user/app/step1/freelec-springboot2-webservice/freelec-springboot2-webservice/src/main/java/com/yeojin/book/config/auth/dto/OAuthAttributes.java uses unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details.

Task :test

com.yeojin.book.domain.posts.PostsRepositoryTest > BaseTimeEntity_post FAILED java.lang.AssertionError at PostsRepositoryTest.java:69 2023-03-30 02:07:23.737 INFO 11702 --- [ Thread-5] o.s.s.concurrent.ThreadPoolTaskExecutor : Shutting down ExecutorService 'applicationTaskExecutor' 2023-03-30 02:07:23.739 INFO 11702 --- [ Thread-7] o.s.s.concurrent.ThreadPoolTaskExecutor : Shutting down ExecutorService 'applicationTaskExecutor' 2023-03-30 02:07:23.744 INFO 11702 --- [ Thread-5] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default' 2023-03-30 02:07:23.744 INFO 11702 --- [ Thread-10] o.s.s.concurrent.ThreadPoolTaskExecutor : Shutting down ExecutorService 'applicationTaskExecutor' 2023-03-30 02:07:23.748 INFO 11702 --- [ Thread-10] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default' 2023-03-30 02:07:23.748 INFO 11702 --- [ Thread-10] .SchemaDropperImpl$DelayedDropActionImpl : HHH000477: Starting delayed evictData of schema as part of SessionFactory shut-down' 2023-03-30 02:07:23.750 INFO 11702 --- [ Thread-5] .SchemaDropperImpl$DelayedDropActionImpl : HHH000477: Starting delayed evictData of schema as part of SessionFactory shut-down' Hibernate: drop table if exists posts Hibernate: drop table if exists posts Hibernate: drop table if exists user Hibernate: drop table if exists user 2023-03-30 02:07:23.759 INFO 11702 --- [ Thread-5] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown initiated... 2023-03-30 02:07:23.765 INFO 11702 --- [ Thread-10] com.zaxxer.hikari.HikariDataSource : HikariPool-2 - Shutdown initiated... 2023-03-30 02:07:23.779 INFO 11702 --- [ Thread-10] com.zaxxer.hikari.HikariDataSource : HikariPool-2 - Shutdown completed. 2023-03-30 02:07:23.784 INFO 11702 --- [ Thread-5] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown completed.

8 tests completed, 1 failed

Task :test FAILED

FAILURE: Build failed with an exception.

Deprecated Gradle features were used in this build, making it incompatible with Gradle 5.0. Use '--warning-mode all' to show the individual deprecation warnings. See https://docs.gradle.org/4.10.2/userguide/command_line_interface.html#sec:command_line_warnings

BUILD FAILED in 32s 5 actionable tasks: 5 executed [ec2-user@freelec-springboot2-webservice freelec-springboot2-webservice]$ ^C [ec2-user@freelec-springboot2-webservice freelec-springboot2-webservice]$ -gradlew -version -bash: -gradlew: command not found [ec2-user@freelec-springboot2-webservice freelec-springboot2-webservice]$ ./gradlew -version


Gradle 4.10.2

Build time: 2018-09-19 18:10:15 UTC Revision: b4d8d5d170bb4ba516e88d7fe5647e2323d791dd

Kotlin DSL: 1.0-rc-6 Kotlin: 1.2.61 Groovy: 2.4.15 Ant: Apache Ant(TM) version 1.9.11 compiled on March 23 2018 JVM: 1.8.0_362 (Red Hat, Inc. 25.362-b08) OS: Linux 5.10.165-143.735.amzn2.x86_64 amd64

[ec2-user@freelec-springboot2-webservice freelec-springboot2-webservice]$

프로젝트 주소

Github에 오류가 난 프로젝트를 올려주세요.
Github 주소를 작성해주지 않으시면 답변해드릴수가 없어요!

오류 로그

어떤 오류인지 캡쳐해주세요. error_

yeojinha commented 1 year ago

해결하였습니다. config에서 JpaConfig가 계속 누락되고 있었습니다.


import org.springframework.context.annotation.Configuration; import org.springframework.data.jpa.repository.config.EnableJpaAuditing;

@Configuration @EnableJpaAuditing // Jpa Auditing 활성화 public class JpaConfig {}

위 파일이 누락되었었고, 해당 파일을 push하고 putty 기존에 있던 클론의 디렉토리를 삭제하고 다시 클론생성하고 test를 진행한 결과, 정상적으로 작동하였습니다.

하지만, 인과관계에 대해서는 아직 잘 모르겠습니다. 스스로 공부를 하면서 더욱 이론적으로 탄탄해져야겠습니다.

만약, 강사님 보신다면 제 댓글에 원인에 대한 설명 부탁드리곗습니다. 0