개발

ERROR org.apache.catalina.core.ContainerBase.[Tomcat].[localhost].[/].[dispatcherServlet] - Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.springframework.htt..

개발자와코더사이가 PM일까? 2020. 12. 7. 00:00
반응형

웹화면에서는 VM136:1 Uncaught SyntaxError: Unexpected end of JSON input이라고 뜨고...

서버에서는 ERROR org.apache.catalina.core.ContainerBase.[Tomcat].[localhost].[/].[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: .......라고 뜨는데

무엇이 문제일까?라고 고민해보았는데 @RestController으로 데이터를 주고 받는데 json의 데이터가 너무 길어서 생기는 문제였다. 예를 들어서 사용자 정보 테이블에서 등록자가 Entity로 될 경우 같은...

해결 방법은 문제가 되는 dto 데이터를 쉽게 풀어라.. 예를들어서 dto userEntity가 있다면 username, userid로 나누어서 받도록 하면 문제가 해결 된다.