Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6920497
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T10:09:17+00:00 2026-05-27T10:09:17+00:00

I have a Java application runnning on a Glassfish server using JSF 2.0.2. at

  • 0

I have a Java application runnning on a Glassfish server using JSF 2.0.2.

at JSF level I have the following method call.

<h:commandLink action="#{printWB.doOpenVehicleToPrintInPDF}" target="_blank">Print</h:commandLink>

My method doOpenVehicleToPrintInPDF is defined as follows:

public String doOpenVehicleToPrintInPDF() {
    FacesContext ctxt = FacesContext.getCurrentInstance();
    HttpServletResponse response = (HttpServletResponse) ctxt.getExternalContext().getResponse();       

    try {
        response.setContentType("application/pdf");
        response.setHeader("Content-disposition", "attachment; filename=\"" + configUrl + ".pdf\"");

        final ServletOutputStream stream = response.getOutputStream();

        final VehiclePrintSummaryToPdf vehiclePrintPdf = new VehiclePrintSummaryToPdf(ctxt, summary);
        vehiclePrintPdf.createPdfDocument(stream, summary);
        stream.flush();
        Validate.isTrue(response.isCommitted());
        stream.close();
    } catch (Exception ex) {
       LOG.error("Error in PDF print processing!", ex);            
    }
    return null;
}

The method is called, the PDF is generated (using the itext library) and afterwards the exception below is thrown. I’ve debugged this and the exception comes after the return null;

Any hint what is wrong here and how to avoid this exception?

Thanks in advance.

java.lang.IllegalStateException
    at org.apache.coyote.tomcat5.CoyoteResponseFacade.setBufferSize(CoyoteResponseFacade.java:260)
    at com.sun.faces.context.ExternalContextImpl.setResponseBufferSize(ExternalContextImpl.java:795)
    at com.sun.faces.application.view.FaceletViewHandlingStrategy.createResponseWriter(FaceletViewHandlingSt
    at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.jav
    at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:126)
    at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:127)
    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:313)
    at org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:427)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:333)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)
    at com.bmw.codis.ncc.web.entrypoint.EntryServletFilterNCC.doFilter(EntryServletFilterNCC.java:98)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:246)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:313)
    at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:287)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:218)
    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:648)
    at org.apache.catalina.core.StandardPipeline.doChainInvoke(StandardPipeline.java:599)
    at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:92)
    at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:222)
    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:648)
    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:593)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:587)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1096)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:166)
    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:648)
    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:593)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:587)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1096)
    at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:288)
    at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.invokeAdapter(DefaultProcessorTask.java
    at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.doProcess(DefaultProcessorTask.java:579
    at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.process(DefaultProcessorTask.java:831)
    at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.executeProcessorTask(DefaultReadTask.java:34
    at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:263)
    at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:214)
    at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:265)
    at com.sun.enterprise.web.connector.grizzly.ssl.SSLWorkerThread.run(SSLWorkerThread.java:106)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T10:09:18+00:00Added an answer on May 27, 2026 at 10:09 am

    The JSF lifecycle is attempting to write to a closed stream during its render phase. To prevent this, you must call responseComplete() on the FacesContext.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have a Java EE-based web application running on a Glassfish app server cluster.
I'm trying to build an Java EE 6-application on GlassFish V3, using JSF 2.0,
I'm developing a web application using JSF 2.0, NetBeans 6.9.1, GlassFish Server 3.1, mojarra
I have a Java EE application running on Glassfish and connecting to MSSQL Server
We have an application running Sun Glassfish app server with Java (JAXRS if it
We have a java application which run as server running on a remote windows
I have made an application using Java/Hibernate/MySQL, but whenever I try running it, it
We have a Java application server running on Sun Solaris. We now need to
We have several java application server running here, with several apps. They all log
I'm doing my first Java EE web application using glassfish and netbeans. When I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.