You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Hermann X Lau <he...@jpmchase.com> on 2009/05/20 22:39:13 UTC

IllegalStateException: Cannot forward. Response already committed.

Thanks in advance for any help on this...

  I understand we get this exception when the JSP attempts to write to the print stream after the response has been committed but I don't see how this is occurring in my situation since my JSP just contains a simple forward.

Index.jsp
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic"%>
<%@ page contentType="text/html" import="org.apache.log4j.Logger"%>
<%
                final Logger log = Logger.getLogger("index.jsp");
                log.debug("begin");
%>
<logic:forward name="welcome" />

Here is my action class (note that in my logs, this exception occurs even before the execute method is called!):
                 public class ChoiceAction extends StrutsAction {

                public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
                                log4j.debug("execute");
                                ManifestChoiceFormBean choiceForm = (ManifestChoiceFormBean) form;
                                Connection conn = DAOUtils.getConnection("jdbc/OSURptDb");

                                try {
                                                RenderRequest req = (RenderRequest)request.getAttribute("javax.portlet.request");
                                                String sites = getResources(request).getMessage("upsws.site.list." + req.getPreferences().getValue("SITE_IND","").toLowerCase());
                                                log4j.debug(sites);
                                                IMailManifestDAO dao = DAOBuilder.buildMailManifestDAO(conn);
                                                boolean uspsActive = dao.uspsJobsExist(sites);
                                                choiceForm.setUspsActive(uspsActive);
                                                log4j.info("USPS link is " + ((uspsActive) ? " active": " not active"));

                                                return mapping.findForward("next");

                                } finally {
                                                DAOUtils.closeConnection(conn);
                                }
                }
                static final Logger log4j = Logger.getLogger(ChoiceAction.class);
}

log:
INFO : 2009-05-20 16:26:18,581 com.bbb.adf.controller.WpsStrutsPortletOSU:WpsStrutsPortletOSU init() using URL = file:/usr/WebSphere/wps61/wp_profile/installedApps/ret7a15
9/PA_MailManifest.ear/MailManifest.war/WEB-INF/classes/log4j.properties
DEBUG: 2009-05-20 16:26:19,264 index.jsp:begin
ERROR: 2009-05-20 16:26:19,713 com.bbb.exceptions.DefaultHandler:Exception caught by default handler.
javax.portlet.PortletException: javax.portlet.PortletException: javax.servlet.jsp.JspException: Exception forwarding for name welcome: java.lang.IllegalStateException: Cannot
forward. Response already committed.
        at com.ibm.portal.struts.command.StrutsViewJspCommand.includeURL(StrutsViewJspCommand.java:192)
        at com.ibm.portal.struts.command.StrutsViewJspCommand.execute(StrutsViewJspCommand.java:154)
....
Caused by:
javax.portlet.PortletException: javax.servlet.jsp.JspException: Exception forwarding for name welcome: java.lang.IllegalStateException: Cannot forward. Response already commit
ted.
        at com.ibm.ws.portletcontainer.core.impl.PortletRequestDispatcherImpl.include(PortletRequestDispatcherImpl.java:125)
        at com.ibm.ws.portletcontainer.core.impl.PortletRequestDispatcherImpl.include(PortletRequestDispatcherImpl.java:230)
        at com.ibm.wps.standard.struts.util.WpsStrutsUtil.include(WpsStrutsUtil.java:2242)
        at com.ibm.portal.struts.command.StrutsViewJspCommand.includeURL(StrutsViewJspCommand.java:186)
        ... 240 more
Caused by:
javax.servlet.jsp.JspException: Exception forwarding for name welcome: java.lang.IllegalStateException: Cannot forward. Response already committed.
        at org.apache.struts.taglib.logic.ForwardTag.doEndTag(ForwardTag.java:173)
        at com.ibm.struts.taglib.logic.ForwardTag.doEndTag(ForwardTag.java:94)
...
DEBUG: 2009-05-20 16:26:19,946 com.bbb.ui.actions.ChoiceAction:execute
DEBUG: 2009-05-20 16:26:20,234 com.bbb.ui.actions.ChoiceAction:CPC,CPC-OH
INFO : 2009-05-20 16:26:20,254 com.bbb.ui.actions.ChoiceAction:USPS link is  not active


I am using WebSphere Portal 6.1


This communication is for informational purposes only. It is not
intended as an offer or solicitation for the purchase or sale of
any financial instrument or as an official confirmation of any
transaction. All market prices, data and other information are not
warranted as to completeness or accuracy and are subject to change
without notice. Any comments or statements made herein do not
necessarily reflect those of JPMorgan Chase & Co., its subsidiaries
and affiliates.

This transmission may contain information that is privileged,
confidential, legally privileged, and/or exempt from disclosure
under applicable law. If you are not the intended recipient, you
are hereby notified that any disclosure, copying, distribution, or
use of the information contained herein (including any reliance
thereon) is STRICTLY PROHIBITED. Although this transmission and any
attachments are believed to be free of any virus or other defect
that might affect any computer system into which it is received and
opened, it is the responsibility of the recipient to ensure that it
is virus free and no responsibility is accepted by JPMorgan Chase &
Co., its subsidiaries and affiliates, as applicable, for any loss
or damage arising in any way from its use. If you received this
transmission in error, please immediately contact the sender and
destroy the material in its entirety, whether in electronic or hard
copy format. Thank you.

Please refer to http://www.jpmorgan.com/pages/disclosures for
disclosures relating to European legal entities.

Re: IllegalStateException: Cannot forward. Response already committed.

Posted by Wes Wannemacher <we...@wantii.com>.
Try turning the page buffer up really high... Like 256k or something 
obnoxious. It's obviously not a real solution, but it might get you by if 
you're on a deadline. I would try firing up a debugger and see what is 
generating the output. Another solution would be to try a different app 
server. If you're running in Tomcat, try Jetty to see if that helps you narrow 
down the issue. 

-Wes

On Thursday 21 May 2009 09:57:20 am Hermann X Lau wrote:
> Hi,
>
> I tried out your suggestions and I am still getting this exception.  I even
> put everything in the JSP in one line and mad sure there were no
> whitespaces.
>
> <%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic"%><%@
> page contentType="text/html" import="org.apache.log4j.Logger"%><%final
> Logger log =
> Logger.getLogger("index.jsp");log.debug("begin");%><logic:forward
> name="welcome" />
>
> Any other ideas?
>
> -----Original Message-----
> From: Wes Wannemacher [mailto:wesw@wantii.com]
> Sent: Wednesday, May 20, 2009 4:48 PM
> To: Struts Users Mailing List
> Subject: Re: IllegalStateException: Cannot forward. Response already
> committed.
>
> The JSP compiler simple turns those <% %> tags inside out and
> everything outside of those tags is a string with an out.print... In
> your case, the first two things in the file generate returns...
> Whitespace is significant... Let me see if I can make it visually more
> understandable
>
> Index.jsp
> <%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic"%>
>         <---- RIGHT HERE, You will get a out.print("\n");
> <%@ page contentType="text/html" import="org.apache.log4j.Logger"%>
> <----- SAME HERE
> <%
>
> Hopefully it doesn't get all wrapped and screwed up.
>
> You might be wondering now, why does it work sometimes and not
> others... Well, the IllegalStateException is only thrown if output has
> been flushed, so you can get away with breaking the rules from time to
> time. You can even set the page buffer variable really high so that
> you reserve the right to redirect, even if you have generated some
> output.
>
> Anyhow, try to remove whitespace, you could probably just do it this
> way and have it work -
> Index.jsp ->
> <%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic" %><%@
>    page contentType="text/html" import="org.apache.log4j.Logger"
> %><%
>                 final Logger log = Logger.getLogger("index.jsp");
>                 log.debug("begin");
>  %><logic:forward name="welcome" />
>
>
> On Wed, May 20, 2009 at 4:39 PM, Hermann X Lau
>
> <he...@jpmchase.com> wrote:
> > Thanks in advance for any help on this...
> >
> >  I understand we get this exception when the JSP attempts to write to the
> > print stream after the response has been committed but I don't see how
> > this is occurring in my situation since my JSP just contains a simple
> > forward.
> >
> > Index.jsp
> > <%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic"%>
> > <%@ page contentType="text/html" import="org.apache.log4j.Logger"%>
> > <%
> >                final Logger log = Logger.getLogger("index.jsp");
> >                log.debug("begin");
> > %>
> > <logic:forward name="welcome" />
> >
> > Here is my action class (note that in my logs, this exception occurs even
> > before the execute method is called!): public class ChoiceAction extends
> > StrutsAction {
> >
> >                public ActionForward execute(ActionMapping mapping,
> > ActionForm form, HttpServletRequest request, HttpServletResponse
> > response) throws Exception { log4j.debug("execute");
> >                                ManifestChoiceFormBean choiceForm =
> > (ManifestChoiceFormBean) form; Connection conn =
> > DAOUtils.getConnection("jdbc/OSURptDb");
> >
> >                                try {
> >                                                RenderRequest req =
> > (RenderRequest)request.getAttribute("javax.portlet.request"); String
> > sites = getResources(request).getMessage("upsws.site.list." +
> > req.getPreferences().getValue("SITE_IND","").toLowerCase());
> > log4j.debug(sites); IMailManifestDAO dao =
> > DAOBuilder.buildMailManifestDAO(conn); boolean uspsActive =
> > dao.uspsJobsExist(sites); choiceForm.setUspsActive(uspsActive);
> > log4j.info("USPS link is " + ((uspsActive) ? " active": " not active"));
> >
> >                                                return
> > mapping.findForward("next");
> >
> >                                } finally {
> >                                              
> >  DAOUtils.closeConnection(conn); }
> >                }
> >                static final Logger log4j =
> > Logger.getLogger(ChoiceAction.class); }
> >
> > log:
> > INFO : 2009-05-20 16:26:18,581
> > com.bbb.adf.controller.WpsStrutsPortletOSU:WpsStrutsPortletOSU init()
> > using URL = file:/usr/WebSphere/wps61/wp_profile/installedApps/ret7a15
> > 9/PA_MailManifest.ear/MailManifest.war/WEB-INF/classes/log4j.properties
> > DEBUG: 2009-05-20 16:26:19,264 index.jsp:begin
> > ERROR: 2009-05-20 16:26:19,713
> > com.bbb.exceptions.DefaultHandler:Exception caught by default handler.
> > javax.portlet.PortletException: javax.portlet.PortletException:
> > javax.servlet.jsp.JspException: Exception forwarding for name welcome:
> > java.lang.IllegalStateException: Cannot forward. Response already
> > committed.
> >        at
> > com.ibm.portal.struts.command.StrutsViewJspCommand.includeURL(StrutsViewJ
> >spCommand.java:192) at
> > com.ibm.portal.struts.command.StrutsViewJspCommand.execute(StrutsViewJspC
> >ommand.java:154) ....
> > Caused by:
> > javax.portlet.PortletException: javax.servlet.jsp.JspException: Exception
> > forwarding for name welcome: java.lang.IllegalStateException: Cannot
> > forward. Response already commit ted.
> >        at
> > com.ibm.ws.portletcontainer.core.impl.PortletRequestDispatcherImpl.includ
> >e(PortletRequestDispatcherImpl.java:125) at
> > com.ibm.ws.portletcontainer.core.impl.PortletRequestDispatcherImpl.includ
> >e(PortletRequestDispatcherImpl.java:230) at
> > com.ibm.wps.standard.struts.util.WpsStrutsUtil.include(WpsStrutsUtil.java
> >:2242) at
> > com.ibm.portal.struts.command.StrutsViewJspCommand.includeURL(StrutsViewJ
> >spCommand.java:186) ... 240 more
> > Caused by:
> > javax.servlet.jsp.JspException: Exception forwarding for name welcome:
> > java.lang.IllegalStateException: Cannot forward. Response already
> > committed. at
> > org.apache.struts.taglib.logic.ForwardTag.doEndTag(ForwardTag.java:173)
> > at com.ibm.struts.taglib.logic.ForwardTag.doEndTag(ForwardTag.java:94)
> > ...
> > DEBUG: 2009-05-20 16:26:19,946 com.bbb.ui.actions.ChoiceAction:execute
> > DEBUG: 2009-05-20 16:26:20,234 com.bbb.ui.actions.ChoiceAction:CPC,CPC-OH
> > INFO : 2009-05-20 16:26:20,254 com.bbb.ui.actions.ChoiceAction:USPS link
> > is  not active
> >
> >
> > I am using WebSphere Portal 6.1
> >

-- 

Wes Wannemacher
Author - Struts 2 In Practice 
Includes coverage of Struts 2.1, Spring, JPA, JQuery, Sitemesh and more
http://www.manning.com/wannemacher


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


RE: IllegalStateException: Cannot forward. Response already committed.

Posted by Hermann X Lau <he...@jpmchase.com>.
Hi,

I tried out your suggestions and I am still getting this exception.  I even put everything in the JSP in one line and mad sure there were no whitespaces.

<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic"%><%@ page contentType="text/html" import="org.apache.log4j.Logger"%><%final Logger log = Logger.getLogger("index.jsp");log.debug("begin");%><logic:forward name="welcome" />

Any other ideas?

-----Original Message-----
From: Wes Wannemacher [mailto:wesw@wantii.com] 
Sent: Wednesday, May 20, 2009 4:48 PM
To: Struts Users Mailing List
Subject: Re: IllegalStateException: Cannot forward. Response already committed.

The JSP compiler simple turns those <% %> tags inside out and
everything outside of those tags is a string with an out.print... In
your case, the first two things in the file generate returns...
Whitespace is significant... Let me see if I can make it visually more
understandable

Index.jsp
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic"%>
        <---- RIGHT HERE, You will get a out.print("\n");
<%@ page contentType="text/html" import="org.apache.log4j.Logger"%>
<----- SAME HERE
<%

Hopefully it doesn't get all wrapped and screwed up.

You might be wondering now, why does it work sometimes and not
others... Well, the IllegalStateException is only thrown if output has
been flushed, so you can get away with breaking the rules from time to
time. You can even set the page buffer variable really high so that
you reserve the right to redirect, even if you have generated some
output.

Anyhow, try to remove whitespace, you could probably just do it this
way and have it work -
Index.jsp ->
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic" %><%@
   page contentType="text/html" import="org.apache.log4j.Logger"
%><%
                final Logger log = Logger.getLogger("index.jsp");
                log.debug("begin");
 %><logic:forward name="welcome" />


On Wed, May 20, 2009 at 4:39 PM, Hermann X Lau
<he...@jpmchase.com> wrote:
> Thanks in advance for any help on this...
>
>  I understand we get this exception when the JSP attempts to write to the print stream after the response has been committed but I don't see how this is occurring in my situation since my JSP just contains a simple forward.
>
> Index.jsp
> <%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic"%>
> <%@ page contentType="text/html" import="org.apache.log4j.Logger"%>
> <%
>                final Logger log = Logger.getLogger("index.jsp");
>                log.debug("begin");
> %>
> <logic:forward name="welcome" />
>
> Here is my action class (note that in my logs, this exception occurs even before the execute method is called!):
>                 public class ChoiceAction extends StrutsAction {
>
>                public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
>                                log4j.debug("execute");
>                                ManifestChoiceFormBean choiceForm = (ManifestChoiceFormBean) form;
>                                Connection conn = DAOUtils.getConnection("jdbc/OSURptDb");
>
>                                try {
>                                                RenderRequest req = (RenderRequest)request.getAttribute("javax.portlet.request");
>                                                String sites = getResources(request).getMessage("upsws.site.list." + req.getPreferences().getValue("SITE_IND","").toLowerCase());
>                                                log4j.debug(sites);
>                                                IMailManifestDAO dao = DAOBuilder.buildMailManifestDAO(conn);
>                                                boolean uspsActive = dao.uspsJobsExist(sites);
>                                                choiceForm.setUspsActive(uspsActive);
>                                                log4j.info("USPS link is " + ((uspsActive) ? " active": " not active"));
>
>                                                return mapping.findForward("next");
>
>                                } finally {
>                                                DAOUtils.closeConnection(conn);
>                                }
>                }
>                static final Logger log4j = Logger.getLogger(ChoiceAction.class);
> }
>
> log:
> INFO : 2009-05-20 16:26:18,581 com.bbb.adf.controller.WpsStrutsPortletOSU:WpsStrutsPortletOSU init() using URL = file:/usr/WebSphere/wps61/wp_profile/installedApps/ret7a15
> 9/PA_MailManifest.ear/MailManifest.war/WEB-INF/classes/log4j.properties
> DEBUG: 2009-05-20 16:26:19,264 index.jsp:begin
> ERROR: 2009-05-20 16:26:19,713 com.bbb.exceptions.DefaultHandler:Exception caught by default handler.
> javax.portlet.PortletException: javax.portlet.PortletException: javax.servlet.jsp.JspException: Exception forwarding for name welcome: java.lang.IllegalStateException: Cannot
> forward. Response already committed.
>        at com.ibm.portal.struts.command.StrutsViewJspCommand.includeURL(StrutsViewJspCommand.java:192)
>        at com.ibm.portal.struts.command.StrutsViewJspCommand.execute(StrutsViewJspCommand.java:154)
> ....
> Caused by:
> javax.portlet.PortletException: javax.servlet.jsp.JspException: Exception forwarding for name welcome: java.lang.IllegalStateException: Cannot forward. Response already commit
> ted.
>        at com.ibm.ws.portletcontainer.core.impl.PortletRequestDispatcherImpl.include(PortletRequestDispatcherImpl.java:125)
>        at com.ibm.ws.portletcontainer.core.impl.PortletRequestDispatcherImpl.include(PortletRequestDispatcherImpl.java:230)
>        at com.ibm.wps.standard.struts.util.WpsStrutsUtil.include(WpsStrutsUtil.java:2242)
>        at com.ibm.portal.struts.command.StrutsViewJspCommand.includeURL(StrutsViewJspCommand.java:186)
>        ... 240 more
> Caused by:
> javax.servlet.jsp.JspException: Exception forwarding for name welcome: java.lang.IllegalStateException: Cannot forward. Response already committed.
>        at org.apache.struts.taglib.logic.ForwardTag.doEndTag(ForwardTag.java:173)
>        at com.ibm.struts.taglib.logic.ForwardTag.doEndTag(ForwardTag.java:94)
> ...
> DEBUG: 2009-05-20 16:26:19,946 com.bbb.ui.actions.ChoiceAction:execute
> DEBUG: 2009-05-20 16:26:20,234 com.bbb.ui.actions.ChoiceAction:CPC,CPC-OH
> INFO : 2009-05-20 16:26:20,254 com.bbb.ui.actions.ChoiceAction:USPS link is  not active
>
>
> I am using WebSphere Portal 6.1
>
>
> This communication is for informational purposes only. It is not
> intended as an offer or solicitation for the purchase or sale of
> any financial instrument or as an official confirmation of any
> transaction. All market prices, data and other information are not
> warranted as to completeness or accuracy and are subject to change
> without notice. Any comments or statements made herein do not
> necessarily reflect those of JPMorgan Chase & Co., its subsidiaries
> and affiliates.
>
> This transmission may contain information that is privileged,
> confidential, legally privileged, and/or exempt from disclosure
> under applicable law. If you are not the intended recipient, you
> are hereby notified that any disclosure, copying, distribution, or
> use of the information contained herein (including any reliance
> thereon) is STRICTLY PROHIBITED. Although this transmission and any
> attachments are believed to be free of any virus or other defect
> that might affect any computer system into which it is received and
> opened, it is the responsibility of the recipient to ensure that it
> is virus free and no responsibility is accepted by JPMorgan Chase &
> Co., its subsidiaries and affiliates, as applicable, for any loss
> or damage arising in any way from its use. If you received this
> transmission in error, please immediately contact the sender and
> destroy the material in its entirety, whether in electronic or hard
> copy format. Thank you.
>
> Please refer to http://www.jpmorgan.com/pages/disclosures for
> disclosures relating to European legal entities.



-- 
Wes Wannemacher
Author - Struts 2 In Practice
Includes coverage of Struts 2.1, Spring, JPA, JQuery, Sitemesh and more
http://www.manning.com/wannemacher

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org

This communication is for informational purposes only. It is not
intended as an offer or solicitation for the purchase or sale of
any financial instrument or as an official confirmation of any
transaction. All market prices, data and other information are not
warranted as to completeness or accuracy and are subject to change
without notice. Any comments or statements made herein do not
necessarily reflect those of JPMorgan Chase & Co., its subsidiaries
and affiliates.

This transmission may contain information that is privileged,
confidential, legally privileged, and/or exempt from disclosure
under applicable law. If you are not the intended recipient, you
are hereby notified that any disclosure, copying, distribution, or
use of the information contained herein (including any reliance
thereon) is STRICTLY PROHIBITED. Although this transmission and any
attachments are believed to be free of any virus or other defect
that might affect any computer system into which it is received and
opened, it is the responsibility of the recipient to ensure that it
is virus free and no responsibility is accepted by JPMorgan Chase &
Co., its subsidiaries and affiliates, as applicable, for any loss
or damage arising in any way from its use. If you received this
transmission in error, please immediately contact the sender and
destroy the material in its entirety, whether in electronic or hard
copy format. Thank you.

Please refer to http://www.jpmorgan.com/pages/disclosures for
disclosures relating to European legal entities.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: IllegalStateException: Cannot forward. Response already committed.

Posted by Wes Wannemacher <we...@wantii.com>.
The JSP compiler simple turns those <% %> tags inside out and
everything outside of those tags is a string with an out.print... In
your case, the first two things in the file generate returns...
Whitespace is significant... Let me see if I can make it visually more
understandable

Index.jsp
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic"%>
        <---- RIGHT HERE, You will get a out.print("\n");
<%@ page contentType="text/html" import="org.apache.log4j.Logger"%>
<----- SAME HERE
<%

Hopefully it doesn't get all wrapped and screwed up.

You might be wondering now, why does it work sometimes and not
others... Well, the IllegalStateException is only thrown if output has
been flushed, so you can get away with breaking the rules from time to
time. You can even set the page buffer variable really high so that
you reserve the right to redirect, even if you have generated some
output.

Anyhow, try to remove whitespace, you could probably just do it this
way and have it work -
Index.jsp ->
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic" %><%@
   page contentType="text/html" import="org.apache.log4j.Logger"
%><%
                final Logger log = Logger.getLogger("index.jsp");
                log.debug("begin");
 %><logic:forward name="welcome" />


On Wed, May 20, 2009 at 4:39 PM, Hermann X Lau
<he...@jpmchase.com> wrote:
> Thanks in advance for any help on this...
>
>  I understand we get this exception when the JSP attempts to write to the print stream after the response has been committed but I don't see how this is occurring in my situation since my JSP just contains a simple forward.
>
> Index.jsp
> <%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic"%>
> <%@ page contentType="text/html" import="org.apache.log4j.Logger"%>
> <%
>                final Logger log = Logger.getLogger("index.jsp");
>                log.debug("begin");
> %>
> <logic:forward name="welcome" />
>
> Here is my action class (note that in my logs, this exception occurs even before the execute method is called!):
>                 public class ChoiceAction extends StrutsAction {
>
>                public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
>                                log4j.debug("execute");
>                                ManifestChoiceFormBean choiceForm = (ManifestChoiceFormBean) form;
>                                Connection conn = DAOUtils.getConnection("jdbc/OSURptDb");
>
>                                try {
>                                                RenderRequest req = (RenderRequest)request.getAttribute("javax.portlet.request");
>                                                String sites = getResources(request).getMessage("upsws.site.list." + req.getPreferences().getValue("SITE_IND","").toLowerCase());
>                                                log4j.debug(sites);
>                                                IMailManifestDAO dao = DAOBuilder.buildMailManifestDAO(conn);
>                                                boolean uspsActive = dao.uspsJobsExist(sites);
>                                                choiceForm.setUspsActive(uspsActive);
>                                                log4j.info("USPS link is " + ((uspsActive) ? " active": " not active"));
>
>                                                return mapping.findForward("next");
>
>                                } finally {
>                                                DAOUtils.closeConnection(conn);
>                                }
>                }
>                static final Logger log4j = Logger.getLogger(ChoiceAction.class);
> }
>
> log:
> INFO : 2009-05-20 16:26:18,581 com.bbb.adf.controller.WpsStrutsPortletOSU:WpsStrutsPortletOSU init() using URL = file:/usr/WebSphere/wps61/wp_profile/installedApps/ret7a15
> 9/PA_MailManifest.ear/MailManifest.war/WEB-INF/classes/log4j.properties
> DEBUG: 2009-05-20 16:26:19,264 index.jsp:begin
> ERROR: 2009-05-20 16:26:19,713 com.bbb.exceptions.DefaultHandler:Exception caught by default handler.
> javax.portlet.PortletException: javax.portlet.PortletException: javax.servlet.jsp.JspException: Exception forwarding for name welcome: java.lang.IllegalStateException: Cannot
> forward. Response already committed.
>        at com.ibm.portal.struts.command.StrutsViewJspCommand.includeURL(StrutsViewJspCommand.java:192)
>        at com.ibm.portal.struts.command.StrutsViewJspCommand.execute(StrutsViewJspCommand.java:154)
> ....
> Caused by:
> javax.portlet.PortletException: javax.servlet.jsp.JspException: Exception forwarding for name welcome: java.lang.IllegalStateException: Cannot forward. Response already commit
> ted.
>        at com.ibm.ws.portletcontainer.core.impl.PortletRequestDispatcherImpl.include(PortletRequestDispatcherImpl.java:125)
>        at com.ibm.ws.portletcontainer.core.impl.PortletRequestDispatcherImpl.include(PortletRequestDispatcherImpl.java:230)
>        at com.ibm.wps.standard.struts.util.WpsStrutsUtil.include(WpsStrutsUtil.java:2242)
>        at com.ibm.portal.struts.command.StrutsViewJspCommand.includeURL(StrutsViewJspCommand.java:186)
>        ... 240 more
> Caused by:
> javax.servlet.jsp.JspException: Exception forwarding for name welcome: java.lang.IllegalStateException: Cannot forward. Response already committed.
>        at org.apache.struts.taglib.logic.ForwardTag.doEndTag(ForwardTag.java:173)
>        at com.ibm.struts.taglib.logic.ForwardTag.doEndTag(ForwardTag.java:94)
> ...
> DEBUG: 2009-05-20 16:26:19,946 com.bbb.ui.actions.ChoiceAction:execute
> DEBUG: 2009-05-20 16:26:20,234 com.bbb.ui.actions.ChoiceAction:CPC,CPC-OH
> INFO : 2009-05-20 16:26:20,254 com.bbb.ui.actions.ChoiceAction:USPS link is  not active
>
>
> I am using WebSphere Portal 6.1
>
>
> This communication is for informational purposes only. It is not
> intended as an offer or solicitation for the purchase or sale of
> any financial instrument or as an official confirmation of any
> transaction. All market prices, data and other information are not
> warranted as to completeness or accuracy and are subject to change
> without notice. Any comments or statements made herein do not
> necessarily reflect those of JPMorgan Chase & Co., its subsidiaries
> and affiliates.
>
> This transmission may contain information that is privileged,
> confidential, legally privileged, and/or exempt from disclosure
> under applicable law. If you are not the intended recipient, you
> are hereby notified that any disclosure, copying, distribution, or
> use of the information contained herein (including any reliance
> thereon) is STRICTLY PROHIBITED. Although this transmission and any
> attachments are believed to be free of any virus or other defect
> that might affect any computer system into which it is received and
> opened, it is the responsibility of the recipient to ensure that it
> is virus free and no responsibility is accepted by JPMorgan Chase &
> Co., its subsidiaries and affiliates, as applicable, for any loss
> or damage arising in any way from its use. If you received this
> transmission in error, please immediately contact the sender and
> destroy the material in its entirety, whether in electronic or hard
> copy format. Thank you.
>
> Please refer to http://www.jpmorgan.com/pages/disclosures for
> disclosures relating to European legal entities.



-- 
Wes Wannemacher
Author - Struts 2 In Practice
Includes coverage of Struts 2.1, Spring, JPA, JQuery, Sitemesh and more
http://www.manning.com/wannemacher

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: IllegalStateException: Cannot forward. Response already committed.

Posted by Dale Newfield <da...@newfield.org>.
Sorry to hijack this thread, but it looks like Wes has already given you 
a pretty complete answer.

At first I thought you were going to be asking about this:
http://wiki.glassfish.java.net/Wiki.jsp?page=FaqWebAppUnableToSetRequestCharEncoding

I get a warning in my glassfish logs for pretty much every request, and 
while I've not spent time to track this down I was hoping someone else 
here might have figured this one out already.

I see that in the prepare method of 
org.apache.struts2.dispatcher.Dispatcher it calls setCharacterEncoding 
on the request, so that does seem pretty early in the process...
...so either that's not getting called or something else is also trying 
to set this later and that's the source of my problems?

-Dale

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org