"java.lang.IllegalStateException: getOutputStream() has already been called for this response" when using JSP scriptlet on JBoss

Solution Verified - Updated -

Issue

We have a JSP page that calls an external Java service, which works fine in Borland Enterprise Environment 6.0, on JDK 1.5, but gives us the following error on JBoss:

    java.lang.IllegalStateException: getOutputStream() has already been called for this response
         at org.apache.catalina.connector.Response.getWriter(Response.java:604)
         at org.apache.catalina.connector.ResponseFacade.getWriter(ResponseFacade.java:198)
         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:191)
         at org.apache.jasper.runtime.JspFactoryImpl.internalReleasePageContext(JspFactoryImpl.java:118)
         at org.apache.jasper.runtime.JspFactoryImpl.releasePageContext(JspFactoryImpl.java:77)
         at org.apache.jsp.crreportsjsp.r_005fdailyBleachingWip_005fcall_jsp._jspService(r_005fdailyBleachingWip_005fcall_jsp.java:166)
         at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
         at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:387)
         at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
         at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:717
         ...

In EAP 7

java.lang.IllegalStateException: UT010006: Cannot call getWriter(), getOutputStream() already called

Environment

  • Red Hat JBoss Enterprise Application Platform (EAP)
    • 7.x
    • 6.x
    • 5.x
    • 4.3

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content