My Oracle Support Banner

IllegalStateException when using getOutputStream() Method in Custom JSP (Doc ID 1116576.1)

Last updated on APRIL 23, 2019

Applies to:

Oracle Business Process Management Suite - Version 10.3.1 and later
Information in this document applies to any platform.
***Checked for relevance on 26-Jul-2012***


If you try to use PdfWriter in a JSP page like in this example:

<f:invoke var="${bpmObject}" methodName="myMethod" retAttName="myAttribute" retAttScope="Page"/>
<% String myAttribute=(String)pageContext.getAttribute("myAttribute");
Document document = new Document(PageSize.A6.rotate(),10, 10, 10, 10);
PdfWriter writer = PdfWriter.getInstance(document,response.getOutputStream());;
document.add(new Phrase(" "));
document.add(new Phrase(" PDF with iTEXT "));
document.add(new Phrase(myAttribute));

you will get this exception using Oracle BPMStudio when you try to run the page:

The task could not be successfully executed.
Reason: 'java.lang.IllegalStateException: getOutputStream() has already been called for this response'.
Caused by: getOutputStream() has already been called for this response
fuego.lang.ComponentExecutionException: The task could not be successfully executed.
Reason: 'java.lang.IllegalStateException: getOutputStream() has already been called for this response'.
at fuego.web.execution.InteractiveExecution.setExecutionError(
at fuego.web.execution.InteractiveExecution.process(
at fuego.web.execution.impl.WebInteractiveExecution.process(
at fuego.web.papi.TaskExecutor.processRedirect(
at fuego.web.papi.TaskExecutor.execute(
at fuego.workspace.servlet.ExecutorServlet.doAction(
at fuego.workspace.servlet.BaseServlet.doPost(
at fuego.workspace.servlet.BaseServlet.doGet(
at javax.servlet.http.HttpServlet.service(
at fuego.workspace.servlet.AuthenticatedServlet.service(
at javax.servlet.http.HttpServlet.service(
at sun.reflect.GeneratedMethodAccessor156.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
Caused by: java.lang.IllegalStateException: getOutputStream() has already been called for this response
at org.apache.catalina.connector.Response.getWriter(
at org.apache.catalina.connector.ResponseFacade.getWriter(
at javax.servlet.ServletResponseWrapper.getWriter(
at org.apache.jasper.runtime.JspWriterImpl.initOut(
at org.apache.jasper.runtime.JspWriterImpl.flushBuffer(
at org.apache.jasper.runtime.PageContextImpl.release(
at org.apache.jasper.runtime.JspFactoryImpl.internalReleasePageContext(
at org.apache.jasper.runtime.JspFactoryImpl.access$100(
at org.apache.jasper.runtime.JspFactoryImpl$
at Method)
at org.apache.jasper.runtime.JspFactoryImpl.releasePageContext(


To view full details, sign in with your My Oracle Support account.

Don't have a My Oracle Support account? Click to get started!

In this Document

This document is being delivered to you via Oracle Support's Rapid Visibility (RaV) process and therefore has not been subject to an independent technical review.
My Oracle Support provides customers with access to over a million knowledge articles and a vibrant support community of peers and Oracle experts.