' java.lang.IllegalStateException: Cannot call sendError() after the response has been committed '
2021-06-15 15:33:24.943 ERROR 17900 --- [nio-8080-exec-1] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.springframework.http.converter.HttpMessageNotWritableException: Could not write JSON: Infinite recursion (StackOverflowError); nested exception is com.fasterxml.jackson.databind.JsonMappingException: Infinite recursion (StackOverflowError) (through reference chain: com.jpacrud.domain.Member["team"]->com.jpacrud.domain.Team["members"]->org.hibernate.collection.internal.PersistentBag[0]->com.jpacrud.domain.Member["team"]->com.jpacrud.domain.Team["members"]->org.hibernate.collection.internal.PersistentBag[0]->com.jpacrud.domain.Member["team"]->com.jpacrud.domain.Team["members"]->org.hibernate.collection.internal.PersistentBag[0]- with root cause
java.lang.StackOverflowError: null
위와 같은 에러발생시
- @JsonManagedReference, @JsonBackReference 추가
@JsonManagedReference
양방향 관계에서 정방향(자식->부모) 참조할 변수에 어노테이션을 추가하면 직렬화에 포함된다
@JsonBackReference
양방향 관계에서 역방향(부모->자식) 참조로 어노테이션을 추가하면 직렬화에서 제외된다
'팁???' 카테고리의 다른 글
깃베시 -bash: ./gradlew: Permission denied 뜰때 (0) | 2022.06.30 |
---|---|
깃허브 액쎤~~ + plain jar 파일 생성 막기요 (0) | 2022.06.28 |
nohup 종료 방법 (0) | 2022.06.01 |
ㅈㅏㅇㅡㅁㅁㅗㅇㅡㅁ 이 ㅈㄹ할때 (3) | 2022.06.01 |
살짝 캘린더 팁 (0) | 2021.03.19 |