What is this error javax.servlet.Servletexception: getOutputStream()?

Asked

Viewed 2,377 times

2

I am generating a report, the moment I click to issue and it displays this error.

Exception:

javax.servlet.ServletException: getOutputStream() has already been called for this response 
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:606) 
    at org.primefaces.webapp.filter.FileUploadFilter.doFilter(FileUploadFilter.java:79)

Root cause:

java.lang.IllegalStateException: getOutputStream() has already been called for this response 
    at org.apache.catalina.connector.Response.getWriter(Response.java:614) 
    at org.apache.catalina.connector.ResponseFacade.getWriter(ResponseFacade.java:199) 
    at com.sun.faces.context.ExternalContextImpl.getResponseOutputWriter(ExternalContextImpl.java:723) 
    at com.sun.faces.application.view.FaceletViewHandlingStrategy.createResponseWriter(FaceletViewHandlingStrategy.java:938) 
    at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:377) 
    at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:125) 
    at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:121) 
    at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101) 
    at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139) 
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:594) 
    at org.primefaces.webapp.filter.FileUploadFilter.doFilter(FileUploadFilter.java:79)

Does anyone know what that mistake represents?

This method is what is generating the error, all other reports coming from this page are normal.

public void emitirRelPlanoEnsino() {

    this.relatorio.put("CURSO", this.ieSelecionada.getId());
    this.relatorio.put("PERIODOLETIVO", this.perLetivo.getId());
    this.relatorio.put("DISCIPLINA", this.planoEnsino.getDisciplina()
            .getId());
    this.relatorio.put("DOCENTE", this.planoEnsino.getDocente().getId());
    this.relatorio.put("CABECALHO", this.caminhoCab);
    this.relatorio.put("SUBREPORT_DIR", this.caminho + "/template_header/");
    this.relatorio.put("SUBREPORTCONT_DIR", this.caminho + "/acad/");
    this.relatorio.put("SUBREPORTBB_DIR", this.caminho + "/acad/");
    this.relatorio
            .put("SUBNODATA_DIR", this.caminho + "/template_no_data/");
    try {
        GeraRelatorio.executarRelatorio(
                "/jasperlt/acad/reportPlanoEnsino.jasper", this.relatorio);
    } catch (Exception e) {
        JSFUtil.addInfoMessage("Erro ao gerar o relatório");
        e.printStackTrace();
    }
}

View

<h:panelGrid columns="2">
    <p:commandButton value="Emitir" icon="ui-icon-print"
        action="#{relGestCursoBacking.gerarRelatorioPlano}"
        title="Clique para gerar o relatório" ajax="false"
        onclick="this.form.target='_blank'" update=":growl" />
    <p:commandButton value="Limpar" icon="ui-icon-cancel"
        actionListener="#{relGestCursoBacking.limpar}" ajax="true"
        process="@this" title="Clique para limpar o formulário"
        update="tblRel" />
</h:panelGrid>

Editing: stacktrace complete

10:25:01,407 SEVERE [javax.enterprise.resource.webcontainer.jsf.application] (http-localhost-127.0.0.1-8080-2) Error Rendering View[/curso/reportGestaoCurso.xhtml]: java.lang.IllegalStateException: getOutputStream() has already been called for this response
    at org.apache.catalina.connector.Response.getWriter(Response.java:614) [jbossweb-7.0.13.Final.jar:]
    at org.apache.catalina.connector.ResponseFacade.getWriter(ResponseFacade.java:199) [jbossweb-7.0.13.Final.jar:]
    at com.sun.faces.context.ExternalContextImpl.getResponseOutputWriter(ExternalContextImpl.java:723) [jsf-impl-2.1.7-jbossorg-2.jar:]
    at com.sun.faces.application.view.FaceletViewHandlingStrategy.createResponseWriter(FaceletViewHandlingStrategy.java:938) [jsf-impl-2.1.7-jbossorg-2.jar:]
    at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:377) [jsf-impl-2.1.7-jbossorg-2.jar:]
    at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:125) [jsf-impl-2.1.7-jbossorg-2.jar:]
    at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:121) [jsf-impl-2.1.7-jbossorg-2.jar:]
    at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101) [jsf-impl-2.1.7-jbossorg-2.jar:]
    at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139) [jsf-impl-2.1.7-jbossorg-2.jar:]
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:594) [jboss-jsf-api_2.1_spec-2.0.1.Final.jar:2.0.1.Final]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329) [jbossweb-7.0.13.Final.jar:]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.13.Final.jar:]
    at org.primefaces.webapp.filter.FileUploadFilter.doFilter(FileUploadFilter.java:79) [primefaces-3.4.1.jar:]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280) [jbossweb-7.0.13.Final.jar:]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.13.Final.jar:]
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275) [jbossweb-7.0.13.Final.jar:]
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161) [jbossweb-7.0.13.Final.jar:]
    at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:153) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final]
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155) [jbossweb-7.0.13.Final.jar:]
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [jbossweb-7.0.13.Final.jar:]
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [jbossweb-7.0.13.Final.jar:]
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368) [jbossweb-7.0.13.Final.jar:]
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877) [jbossweb-7.0.13.Final.jar:]
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:671) [jbossweb-7.0.13.Final.jar:]
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:930) [jbossweb-7.0.13.Final.jar:]
    at java.lang.Thread.run(Unknown Source) [rt.jar:1.7.0_25]

10:25:01,424 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/sigaac].[Faces Servlet]] (http-localhost-127.0.0.1-8080-2) Servlet.service() for servlet Faces Servlet threw exception: java.lang.IllegalStateException: getOutputStream() has already been called for this response
    at org.apache.catalina.connector.Response.getWriter(Response.java:614) [jbossweb-7.0.13.Final.jar:]
    at org.apache.catalina.connector.ResponseFacade.getWriter(ResponseFacade.java:199) [jbossweb-7.0.13.Final.jar:]
    at com.sun.faces.context.ExternalContextImpl.getResponseOutputWriter(ExternalContextImpl.java:723) [jsf-impl-2.1.7-jbossorg-2.jar:]
    at com.sun.faces.application.view.FaceletViewHandlingStrategy.createResponseWriter(FaceletViewHandlingStrategy.java:938) [jsf-impl-2.1.7-jbossorg-2.jar:]
    at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:377) [jsf-impl-2.1.7-jbossorg-2.jar:]
    at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:125) [jsf-impl-2.1.7-jbossorg-2.jar:]
    at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:121) [jsf-impl-2.1.7-jbossorg-2.jar:]
    at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101) [jsf-impl-2.1.7-jbossorg-2.jar:]
    at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139) [jsf-impl-2.1.7-jbossorg-2.jar:]
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:594) [jboss-jsf-api_2.1_spec-2.0.1.Final.jar:2.0.1.Final]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329) [jbossweb-7.0.13.Final.jar:]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.13.Final.jar:]
    at org.primefaces.webapp.filter.FileUploadFilter.doFilter(FileUploadFilter.java:79) [primefaces-3.4.1.jar:]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280) [jbossweb-7.0.13.Final.jar:]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.13.Final.jar:]
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275) [jbossweb-7.0.13.Final.jar:]
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161) [jbossweb-7.0.13.Final.jar:]
    at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:153) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final]
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155) [jbossweb-7.0.13.Final.jar:]
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [jbossweb-7.0.13.Final.jar:]
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [jbossweb-7.0.13.Final.jar:]
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368) [jbossweb-7.0.13.Final.jar:]
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877) [jbossweb-7.0.13.Final.jar:]
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:671) [jbossweb-7.0.13.Final.jar:]
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:930) [jbossweb-7.0.13.Final.jar:]
    at java.lang.Thread.run(Unknown Source) [rt.jar:1.7.0_25]
  • put the code that generates this error to make it easier to help

  • How is your view? You always have the same button, for example p:commandButton for all reports, including those that work?

  • In the other reports the method that generates them is different and are in another <p:tab>

  • The excerpt from view that included flame gerarRelatorioPlano and you included the action emitirRelPlanoEnsino. It’s the same thing?

  • gerarRelatorioPlano calls the emit. is just the call method.

  • There’s nothing in it? It just calls, there’s nothing like a responseComplete?

  • No. Just the call. public void gerarRelatorioPlano(){ emitRelPlanoEnsino(); }

  • Dude, really weird. Test h:commandButton and if the error continues is something in your MB or this guy who generates the report... Without seeing more code it becomes difficult to say what is.

  • Blz Bruno... I’ll take a look here and tell you what it was. VLW

  • @Marcosraialvesdacunha, is a little obscutory yet, but you already tried to take a look at this link, it seems that the guy had the same problem: http://stackoverflow.com/questions/1776142/getoutputstream-has-already-been-called-for-this-response

  • 1

    Guys... the flaw was in the report they sent me... there was a Ner Jay that wasn’t there... These things happen...

Show 6 more comments
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.