728x90
에러코드
httpmessagenotwritableexception
문제상황
: Page형 데이터를 get 요청으로 받으려 했을 때 발생
: 디버깅 상으로는 값이 잘 받아지나, ResponseEntity로 반환할 때 Postman에서 에러발생
원인
1. 순환참조가 일어나서 발생 (필자의 경우)
2. @Getter @Setter 등 애너테이션을 빼먹은 경우
해결방법
1. 순환참조가 발생한 경우 : @Data 등의 애너테이션으로 인해 발생하거나, 엔티티 매핑간의 문제일 수 있다.
: 엔티티 클래스에서 매핑된 전략을 확인하거나, 불필요한 매핑이 있는지 확인하여 제거해본다.
: @Data 애너테이션을 사용하고 있다면 @Getter @Setter @Builder 등으로 바꾼다
2. 엔티티에 @Getter를 넣는다.
728x90
'Java & Spring > Error' 카테고리의 다른 글
| [SpringBoot] hibernateLazyInitializer 및 순환참조 에러 (0) | 2022.11.19 |
|---|---|
| [SpringBoot] Caused by: java.sql.SQLSyntaxErrorException: Can't DROP 'FKpvill444mvu6ace1wvwpc9iob'; check that column/key exists 에러 (0) | 2022.11.18 |
| [SpringBoot] DataIntegrityViolationException (0) | 2022.11.14 |
| [SpringBoot] Asciidoctor 인식 오류 (0) | 2022.11.06 |
| [SpringBoot] failed to load applicationcontext (0) | 2022.11.02 |