🛤️현상
2023-06-21 17:09:46.561 WARN 11180 --- [nio-8080-exec-7] .w.s.m.s.DefaultHandlerExceptionResolver : Resolved [org.springframework.http.converter.HttpMessageNotReadableException: JSON parse error: Cannot construct instance of
hanium.highwayspring.school.School
(although at least one Creator exists): no int/Int-argument constructor/factory method to deserialize from Number value (1); nested exception is com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot construct instance of
hanium.highwayspring.school.School
(although at least one Creator exists): no int/Int-argument constructor/factory method to deserialize from Number value (1) at [Source: (org.springframework.util.StreamUtils$NonClosingInputStream); line: 10, column: 16] (through reference chain: hanium.highwayspring.review.ReviewDTO["schoolId"])]
🌸과정
hanium.highwayspring.school.School 클래스에서 int/Int-argument 생성자 또는 팩토리 메서드가 없어서 해당 오류가 발생했고.
또한, ReviewDTO 클래스에서 schoolId 필드의 값이 Number 타입으로 제공되었는데
해당 값을 역직렬화할 수 있는 int/Int-argument 생성자 또는 팩토리 메서드도 없어서 오류가 발생했습니다.
들어오는 값은 Long 자료형인데, review 엔티티에 있는 schoolId 필드는 School 타입이라 오류가 발생한 거 같아
School 클래스에서 int/Int-argument 생성자 생성해 보기로 했다.
🗝️해결
'개발일지 > 2023_한이음' 카테고리의 다른 글
[개발]🚨ERROR - cannot find symbol(클래스) 에러 (0) | 2023.06.25 |
---|---|
[개발]🎁배운점 - @JoinColumn이 없다면?? (0) | 2023.06.24 |
[개발]🚨ERROR - javax.persistence.NonUniqueResultException: (0) | 2023.06.22 |
[개발]🎁배운점 - ifPresent() 메서드 (0) | 2023.06.21 |
[개발]🤦🏻♀️고민하기 - review 기능에 커스텀 DTO 적용 (1) | 2023.06.17 |