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();

 

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();

+ Recent posts