본문 바로가기
ETC/Error

Cannot call sendError() after the response has been committed

by 은z 2022. 2. 18.

상황

JPA 매핑 중 발생한 에러이다.

java.lang.IllegalStateException: Cannot call sendError() after the response has been committed

 

 

원인

Board 안에 있는 BoardTag 리스트가 Board 을 참조하고

BoardTag 안에 있는 Board 이 서로를 참조하면서 무한 재귀함수가 실행 되게 된다.

 

 

 

해결방법

@ManyToOne 쪽에 있는

Board Entity에게 @JsonIdentityInfo 또는 @JsonIgnore 설정을 해서 무한재귀를 끊어야 한다.

댓글