500: Internal Server Error

zae·2022년 11월 28일
0

TroubleShooting

목록 보기
3/4
post-custom-banner

통신을 하던 중 다음과 같이 500: "Internal Server Error" 에러와 마주했다..!

🚨 문제 원인

에러코드를 확인하면, Cannot construct instance of `com.example.demo.src.user.model.User` (no Creators, like default constructor, exist): cannot deserialize from Object value (no delegate- or property-based Creator)을 볼 수 있다!
no Creators를 보고 생성자 관련 문제라는 것을 알 수 있었다

에러 코드

14:51:43.191 ERROR [File:DirectJDKLog.java] [Func:log] [Line:175] [Message:Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.springframework.http.converter.HttpMessageConversionException: Type definition error: [simple type, class com.example.demo.src.user.model.User]; nested exception is com.fasterxml.jackson.databind.exc.InvalidDefinitionException: Cannot construct instance of `com.example.demo.src.user.model.User` (no Creators, like default constructor, exist): cannot deserialize from Object value (no delegate- or property-based Creator)
 at [Source: (PushbackInputStream); line: 2, column: 5]] with root cause]- Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.springframework.http.converter.HttpMessageConversionException: Type definition error: [simple type, class com.example.demo.src.user.model.User]; nested exception is com.fasterxml.jackson.databind.exc.InvalidDefinitionException: Cannot construct instance of `com.example.demo.src.user.model.User` (no Creators, like default constructor, exist): cannot deserialize from Object value (no delegate- or property-based Creator)
 at [Source: (PushbackInputStream); line: 2, column: 5]] with root cause
com.fasterxml.jackson.databind.exc.InvalidDefinitionException: Cannot construct instance of `com.example.demo.src.user.model.User` (no Creators, like default constructor, exist): cannot deserialize from Object value (no delegate- or property-based Creator)
 at [Source: (PushbackInputStream); line: 2, column: 5]

🔨 해결 과정

@NoArgsConstructor 어노테이션을 추가해줬다
default 생성자가 없어서 발생한 문제라 생각했고, 기본 생성자를 생성해주는 해당 어노테이션을 통해 해결했다!

❤️‍🩹 해결 완료

뚝 딱 !

profile
코린이 성장 과정! 깊이 있게 파고들 공부를 탐색하고 있습니다 :)
post-custom-banner

0개의 댓글