IT/디버깅 22

spring security filter exception 처리 이슈 해결

jwt 토큰이 만료되었을 때의 응답을 처리하려고 하였습니다. ExpiredException을 받아 handling하려고 하였으나, global exception을 handling하기 위해 기존에 존재하던 @RestControllerAdvice는 security filter 단에서의 에러를 handling하지 못하였습니다. 이는 sevlet에 들어오기 전에 동작하는 것이었기 때문입니다.이에 이를 해결하는 과정을 포스팅합니다. spring security filter exception 해결 시도 1 아래의 사진에서 보듯 try catch 문을 통해 Exception이 발생한 경우 response writer를 사용해 응답을 반환해주려 하였습니다. 하지만 httpResponse에 wirte이 되지 않아 문제를..

IT/디버깅 2024.02.15

oneToMany가 연속적일 때 failed to lazily initialize a collection of role 에러 해결

member에 ticket이 1:N으로 있고 ticket에 1:N으로 file이 있는 연관관계에서 LazyLoadingException이 발생하여서 문제를 해결하는 과정을 기록합니다. nested fetch를 하려고 하였으나, org.hibernate.loader.MultipleBagFetchException이 발생하여 쿼리를 분리하던 과중에서 생긴 문제입니다. LazyLoading 문제상황 @Override public Member findMemberWithTicketsAndMemberTeamsByMemberId(Long memberId) { Member memberWithTickets = memberRepository.findMemberWithTicketsById(memberId) .orElseThr..

IT/디버깅 2024.01.28

jwt 사용 시 remember me 적용 안되는 이슈

spring version 3.xx 와 jwt를 사용해 login을 구현한 프로젝트에서 remember me 로 로그인 유지를 구현하려고 하는 중 remember me cookie가 생성되지 않아 이를 해결하는 과정을 포스팅합니다. 1. RememberMe가 동작하지 않는지 체크 spring security의 rememberMeAuthenicationFilter는 잘 동작하고 있음을 확인했습니다. 2. 다른 원인에 대한 고민 - Session Cookie SecurityConfig의 SessionCreationPoilicy.STATELESS 사용은 Session을 생성하지 않음을 확인하였고, 쿠키 기반인 remember-me 세션 쿠키가 생성되지 않는 것이 당연한 것이었습니다. 따라서 Security의 ..

IT/디버깅 2024.01.25

@WithMockUser 사용시 요청에 사용되는 User와 MockUser가 다른 경우 발생하는 에러 401

이번 포스팅에서는 realUser로 테스트를 작성해야 하는데 @WithMockUser 로 Authentication을 하게 되면, 인증과 인가의 context가 달라 401 에러가 발생하는 이슈를 해결하는 과정을 설명하고 있습니다. @WithMockUser 코드 @Test @Transactional @WithMockUser ( username = "patient", roles = { "PATIENT" } ) @DisplayName("testDeleteAppointmentRequestsAPI - 성공") public void testDeleteAppointmentRequestsAPI () throws Exception { // given final AppointmentRequestForm appointme..

IT/디버깅 2023.11.11

"query specified join fetching, but the owner of the fetched association was not present in the select list" 에러 원인과 해결

queryDsl을 사용하던 중 query specified join fetching, but the owner of the fetched association was not present in the select list 에러가 발생하여 원인과 해결과정에 대해 정리하는 포스팅입니다. 1. error의 원인 코드 jpaQueryFactory .select(mainPayment.itemImage, mainPayment.itemName, mainPayment.subPayment.pointUse) .from(mainPayment) .join(mainPayment.subPayment, subPayment) .fetchJoin() .fetchOne(); 위의 코드를 살펴보면 subPayment를 join 한 후 N..

IT/디버깅 2023.10.28

[디버깅] yolo8 FileNotFoundError: Image Not Found 이슈 해결

이번 포스팅에서는 인턴 ML 과제를 하던 중 발생한 이슈를 해결한 과정에 대해 기록하려고 합니다. 구체적으로는 yolo8에 image 파일이 존재함에도 불구하고 FileNotFound: Image Not Found 이슈가 발생하여 이를 해결하는 과정을 기록하였습니다. yolo8 FileNotFoundError 원인 cv2를 사용할 때 window에서 한글 경로를 읽지 못하기 때문에 발생하였습니다. * 원인을 찾은 과정정리 1. cv2를 사용해 이미지를 가져오는데 이부분에서 에러가 발생하였습니다. print()로 찍어보니 file이 None임을 체크하였고 이와 관련해 구글링을 해보았습니다. yolo8 FileNotFoundError 해결 아래와 같이 convert to Utf8 코드를 작성하여 file을 ..

IT/디버깅 2023.07.26

[디버깅] 구글 코랩 tensorflow light install 이슈 해결

Can't install tflite-model-maker from pip 에러가 발생하여 해결하는 과정을 적었습니다. INFO: pip is looking at multiple versions of tensorflow to determine which version is compatible with other requirements. This could take a while. 이슈 1. tensorflow light 다운로드 이슈 원인 Requirement already satisfied: pycocotools in /usr/local/lib/python3.10/dist-packages (from tf-models-nightly->tflite-model-maker) (2.0.6) Collecting ..

IT/디버깅 2023.07.20

[디버깅] bitbucket permission denied 오류 해결

이번 포스팅에서는 bitbucket permission denied 오류 해결 과정에 대해 포스팅하겠습니다. 1. git bash 에서 ssh-keygen -t rsa -C 이메일를 치고 ssh key를 받는다. (저는 ssh key를 chips라는 이름으로 만들었습니다.) 2.만든 ssh 를 등록한다. ssh-add ~/.ssh/chips 하지만 could not open a connection to your authentication agent 에러가 발생할 수 있습니다. could not open a connection to your authentication agent 에러 해결 방법 eval $(ssh-agent) 를 쳐서 agent 프로세스를 생성하고 ssh-add ~/.ssh/chips 3...

IT/디버깅 2023.04.26

[디버깅] jdbSqlSyntaxErrorException Table not found 이슈 해결

이번 포스팅에서는 JPA 사용 중 발생한 jdbSqlSyntaxErrorException Table not found 이슈를 해결하는 과정을 포스팅 하려 합니다. 1. Table not Found 이슈 상황 @SpringBootTest class LatterServiceTest { @Autowired MemberService memberService; @Autowired LatterService latterService; @Autowired EntityManager em; @Autowired TransactionTemplate transactionTemplate; @AfterEach public void 지우기() { System.out.println("======@AfterEach======"); me..

IT/디버깅 2023.04.05

[디버깅] test 코드에서 em.remove() delete 쿼리 안나가는 이슈 해결

JPA로 em.remove()를 하였지만 delete 쿼리가 나가지 않는 에러가 발생하여 이를 해결하는 과정을 포스팅하려고 합니다. 1. delete 쿼리 안나가는 이슈 상황 1. test 코드입니다. 코드는 간단하게 아래와 같습니다. package dev.devpool.service; import dev.devpool.domain.Child; import dev.devpool.domain.Member; import static org.junit.jupiter.api.Assertions.*; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframe..

IT/디버깅 2023.03.30
728x90