TIL - 무한 redirect | IllegalStateException

su·2023년 7월 5일
0

TIL

목록 보기
36/93
post-thumbnail

문제1 - 계속 로그인 화면으로 돌아감

1) 문제

화면에서 버튼을 누르면 올바른 처리를 할 수 있도록 링크가 동작해야 하는데, 자꾸 로그인 화면으로 튕겼다 ..
이유가 뭔지.. 일단 서버쪽으로 제대로 데이터가 전송되지 않았던 것 같은데, 서버쪽에서 돌아가는 코드 상에는 문제가 없어보였다.
그러면 새로 작성해본 html 파일에서 문제가 있는 건가 ..?

2) 시도

일단 사용하는 HTTP 메소드와 API가 일치하는지 부터 살펴보았다.
문제는 없었다 .. 전혀..
그럼 어디가 문제인거지 ?

3) 해결

프론트 쪽에서 input submit으로 수행하고 있었는데 이를 바꿔주니 제대로 동작했다.
input submit type을 사용하면 안되나보다 ㅠㅡㅠ

4) 배운 점

서버쪽을 공부하다가 갑자기 프론트랑 연결하려니까 정말 하나도 모르겠다.. 너무어렵다........

문제2 - 오류

1) 문제

java.lang.IllegalStateException: Failed to load ApplicationContext for [WebMergedContextConfiguration@12d8e6b6 testClass = com.example.cloudsky.CloudskyApplicationTests, locations = [], classes = [com.example.cloudsky.CloudskyApplication], contextInitializerClasses = [], activeProfiles = [], propertySourceLocations = [], 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.WebDriverContextCustomizerFactory$Customizer@241e8ea6, org.springframework.boot.test.context.filter.ExcludeFilterContextCustomizer@3bcbb589, org.springframework.boot.test.json.DuplicateJsonObjectContextCustomizerFactory$DuplicateJsonObjectContextCustomizer@6c45ee6e, org.springframework.boot.test.mock.mockito.MockitoContextCustomizer@0, org.springframework.boot.test.web.client.TestRestTemplateContextCustomizer@5911e990, org.springframework.boot.test.context.SpringBootTestAnnotation@33a4545f], resourceBasePath = "src/main/webapp", contextLoader = org.springframework.boot.test.context.SpringBootContextLoader, parent = null]
	at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:143)
	at org.springframework.test.context.support.DefaultTestContext.getApplicationContext(DefaultTestContext.java:127)
	at org.springframework.test.context.web.ServletTestExecutionListener.setUpRequestContextIfNecessary(ServletTestExecutionListener.java:191)
	at org.springframework.test.context.web.ServletTestExecutionListener.prepareTestInstance(ServletTestExecutionListener.java:130)
	at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:241)
	at org.springframework.test.context.junit.jupiter.SpringExtension.postProcessTestInstance(SpringExtension.java:138)
	at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.lambda$invokeTestInstancePostProcessors$10(ClassBasedTestDescriptor.java:377)
	at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.executeAndMaskThrowable(ClassBasedTestDescriptor.java:382)
	at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.lambda$invokeTestInstancePostProcessors$11(ClassBasedTestDescriptor.java:377)
	at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)
	at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:179)
	at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1625)
	at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)

아니.. 뭐 좀 추가했다고 진짜 이럴거야 ..?
이게 무슨일이야 정말로 .. clean 했다가 다시 build 해도 같은 오류가 나서 정말로 당황했다..

2) 시도

Bean에서 에러가 나는 경우가 있고, DB 설정이나 쿼리문이 작성되는 xml 파일을 점검해볼 수 있다고 한다.
나는 쿼리문이나 xml 파일을 작성해주지 않아서 볼 수 가 없었다.
출처: https://beagle-dev.tistory.com/122

3) 해결

그럼 Bean 생성에서 오류가 있던 것 같은데,,
하고 오류 메시지를 chat 친구에게 물어보니
Comment.. 어쩌구 CreateTime .. 어쩌구 라고 알려주었다
아 그러면 혹시 내가 필드명을 잘못 줬나 ? 해서 파일을 다시 보니
Repository를 만들 때, 설정한 필드 명과 다르게 주어서 그랬던 것이다..

4) 배운 점

필드 명을 잘못 준 상태로 Bean을 생성하려고 하면 build도 되지 않는 사태가 발생하니 주의해야겠다.
오류 파티를 봐서 정말 당황했다 ..

profile
(❁´◡`❁)

0개의 댓글