티스토리 뷰

에러 상황 : getOutputStream() has already been called for this response

 

JSP  처리 중에 발생하는 다음과 같은 오류 메세지.

Servlet.service() for servlet [jsp] in context with path [] threw exception [java.lang.IllegalStateException: getOutputStream() has already been called for this response] with root cause
java.lang.IllegalStateException: getOutputStream() has already been called for this response
        at org.apache.catalina.connector.Response.getWriter(Response.java:678)
        at org.apache.catalina.connector.ResponseFacade.getWriter(ResponseFacade.java:213)
        at org.apache.jasper.runtime.JspWriterImpl.initOut(JspWriterImpl.java:125)
        at org.apache.jasper.runtime.JspWriterImpl.flushBuffer(JspWriterImpl.java:118)
        at org.apache.jasper.runtime.PageContextImpl.release(PageContextImpl.java:194)
        at org.apache.jasper.runtime.JspFactoryImpl.internalReleasePageContext(JspFactoryImpl.java:126)
        at org.apache.jasper.runtime.JspFactoryImpl.releasePageContext(JspFactoryImpl.java:80)

 

그리고 코드 중에 다음과 같이 getOutputStream() 이 있다.

fout = new BufferedOutputStream(response.getOutputStream());

 

JSP 를 Servlet 으로 변하는 과정에 생기는 OutputStream 때문인데, 다음을 통해 JSP 자체의 OutputStream 을 제거할 필요가 있다. 반드시 getOutputStream() 앞에 위치시킨다.

out.clear();
out=pageContext.pushBody();



출처: http://seemoon.tistory.com/entry/JSP-처리-중-javalangIllegalStateException-getOutputStream-has-already-been-called-for-this-response [눈부시도록 아름다운 그래서 바라볼 수 없는]

 

댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2025/05   »
1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31
글 보관함