[Spring Boot] 내장, 외장 톰캣 이슈

0

Spring & Spring Boot

목록 보기
1/1
post-thumbnail

이슈


Cannot forward to error page for request [/xxx/xxx/xxx] as the response has already been committed. As a result, the response may have the wrong status code. If your application is running on WebSphere Application Server you may be able to resolve this problem by setting com.ibm.ws.webcontainer.invokeFlushAfterService to false.

  • Ajax 통신시 내장 톰캣에서는 문제가 없었는데, 개발 서버 (외장 톰캣)에서 위와 같은 메세지가 리턴되었습니다.

  • 기본적으로 Spring boot에서는 에러를 처리하는 filter가 자동으로 동작한다. 하지만 프로젝트에 따라 Application내에서 에러 핸들링을 달리해야 하는데 Filter에서 선처리하고 아래와 같은 에러 로그를 출력한다.

참고
https://smallgiant.tistory.com/73
https://naning9.tistory.com/12

해결


컨트롤러 리턴에 @ResponseBody 나 ReponseEntity로 직접 http 상태 코드를 반환해주면 해결됩니다.

profile
모두의 개발 시행착오를 줄이기 위해 차근차근 가고 있습니다.

0개의 댓글