카테고리 없음

Whitelabel Error Page 500, NullPointerException

suh75321 2024. 6. 14. 23:23

여러 방법을 다 써봤지만 실패한 상황에서 SecurityConfig에서

 

baseurl이라 되어있는 부분을

oauthConfig.authorizationEndpoint {
    it.baseUri("http://localhost:8080/oauth2/login") // 로컬호스트로 설정
}.redirectionEndpoint {
    it.baseUri("http://localhost:8080/oauth2/callback/kakao") // 로컬호스트로 설정
}.userInfoEndpoint {

이렇게 바꿔보았는데,

jwt 오류 대신

Whitelabel Error Page

This application has no explicit mapping for /error, so you are seeing this as a fallback.

Fri Jun 14 21:12:08 KST 2024
There was an unexpected error (type=Internal Server Error, status=500).
이렇게 나오기 시작했다. 우선 뭔가 변화는 있었기 때문에 이쪽을 해결해 보려고 한다.
그리고 디버그는
Fri Jun 14 21:00:14 KST 2024 There was an unexpected error (type=Internal Server Error, status=500). 이러고 2024-06-14T21:12:08.045+09:00 DEBUG 20772 --- [nio-8080-exec-1] o.s.security.web.FilterChainProxy : Securing GET /oauth2/callback/kakao?code=nQ9chwaAlDCrgz3jLUbLVjG0o0xVxZWmMjCMyvp2G2ZcTIM81LMbtgAAAAQKKwzSAAABkBapiRfRDLJpR7eCqA 2024-06-14T21:12:08.061+09:00 DEBUG 20772 --- [nio-8080-exec-1] o.s.s.w.a.AnonymousAuthenticationFilter : Set SecurityContextHolder to anonymous SecurityContext 2024-06-14T21:12:08.061+09:00 DEBUG 20772 --- [nio-8080-exec-1] o.s.s.w.session.SessionManagementFilter : Request requested invalid session id 36D70F46480C30BBBA64F3E3B478F92D 2024-06-14T21:12:08.064+09:00 DEBUG 20772 --- [nio-8080-exec-1] o.s.security.web.FilterChainProxy : Secured GET /oauth2/callback/kakao?code=nQ9chwaAlDCrgz3jLUbLVjG0o0xVxZWmMjCMyvp2G2ZcTIM81LMbtgAAAAQKKwzSAAABkBapiRfRDLJpR7eCqA 2024-06-14T21:12:08.114+09:00 ERROR 20772 --- [nio-8080-exec-1] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed: java.lang.NullPointerException: Parameter specified as non-null is null: method org.example.domain.user.UserController.handleKakaoCallback, parameter oAuth2User] with root cause java.lang.NullPointerException: Parameter specified as non-null is null: method org.example.domain.user.UserController.handleKakaoCallback, parameter oAuth2User at org.example.domain.user.UserController.handleKakaoCallback(UserController.kt) ~[main/:na] at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103) ~[na:na] at java.base/java.lang.reflect.Method.invoke(Method.java:580) ~[na:na]이러고 2024-06-14T21:12:08.135+09:00 DEBUG 20772 --- [nio-8080-exec-1] o.s.security.web.FilterChainProxy : Securing GET /error?code=nQ9chwaAlDCrgz3jLUbLVjG0o0xVxZWmMjCMyvp2G2ZcTIM81LMbtgAAAAQKKwzSAAABkBapiRfRDLJpR7eCqA 2024-06-14T21:12:08.136+09:00 DEBUG 20772 --- [nio-8080-exec-1] o.s.security.web.FilterChainProxy : Secured GET /error?code=nQ9chwaAlDCrgz3jLUbLVjG0o0xVxZWmMjCMyvp2G2ZcTIM81LMbtgAAAAQKKwzSAAABkBapiRfRDLJpR7eCqA 2024-06-14T21:12:08.184+09:00 DEBUG 20772 --- [nio-8080-exec-1] o.s.s.w.a.AnonymousAuthenticationFilter : Set SecurityContextHolder to anonymous SecurityContext 2024-06-14T21:12:08.680+09:00 DEBUG 20772 --- [nio-8080-exec-2] o.s.security.web.FilterChainProxy : Securing GET /favicon.ico 2024-06-14T21:12:08.681+09:00 DEBUG 20772 --- [nio-8080-exec-2] o.s.s.w.a.AnonymousAuthenticationFilter : Set SecurityContextHolder to anonymous SecurityContext 2024-06-14T21:12:08.681+09:00 DEBUG 20772 --- [nio-8080-exec-2] o.s.s.w.session.SessionManagementFilter : Request requested invalid session id 36D70F46480C30BBBA64F3E3B478F92D 2024-06-14T21:16:35.177+09:00 DEBUG 20772 --- [nio-8080-exec-4] o.s.security.web.FilterChainProxy : Securing GET /login?error 2024-06-14T21:16:35.196+09:00 DEBUG 20772 --- [nio-8080-exec-4] o.s.s.w.a.AnonymousAuthenticationFilter : Set SecurityContextHolder to anonymous SecurityContext 2024-06-14T21:16:35.197+09:00 DEBUG 20772 --- [nio-8080-exec-4] o.s.s.w.session.SessionManagementFilter : Request requested invalid session id 36D70F46480C30BBBA64F3E3B478F92D 2024-06-14T21:16:35.534+09:00 DEBUG 20772 --- [nio-8080-exec-5] o.s.security.web.FilterChainProxy : Securing GET /favicon.ico 2024-06-14T21:16:35.535+09:00 DEBUG 20772 --- [nio-8080-exec-5] o.s.s.w.a.AnonymousAuthenticationFilter : Set SecurityContextHolder to anonymous SecurityContext 2024-06-14T21:16:35.535+09:00 DEBUG 20772 --- [nio-8080-exec-5] o.s.s.w.session.SessionManagementFilter : Request requested invalid session id 36D70F46480C30BBBA64F3E3B478F92D
 
이렇게 나오는데, org.example.domain.user.UserController.handleKakaoCallback 메소드에서 oAuth2User 파라미터가 null로 전달되는 NullPointerException이 나온 모양이다. 내가 그걸 바꿔서인지, 아니면 여러 시도중에 발생한 문제인지 확실치 않아서 조사중이다.