Cannot forward. Writer or Stream already obtained.

hi Friends,
had a small doubt to clarify
I am using jsp:include tag to include a jsp page within a jsp
<jsp:include page="../includes/empHeader.jsp" flush="true">
<jsp:param name="empid" value="<%=empid%>"/>
</jsp:include>
<jsp:include page="../leave/leaverecordcomponent.jsp" flush="true">
<jsp:param name="empid" value="<%=empid%>"/>
</jsp:include>
I am able to view empHeader.jsp but unable to view leaverecordcomponent.jsp
I m getting this error
Error 500: ERROR: Cannot forward. Writer or Stream already obtained. Error 500:
However if i replace
<jsp:include page="../leave/leaverecordcomponent.jsp" flush="true">
by
<jsp:include page="../employee/Skills.jsp" flush="true">
then i can view empHeader.jsp and then Skills.jsp
What's to be done ?
Thanx

I am guessing that "../leave/leaverecordcomponent.jsp" does a forward, either through a controller servlet, a filter, or on the page it self.
What can you do? Prevent ../leave/leaverecordcomponent.jsp from doing a forward, because once the response is commited (something writtent to it), then you can not forward.

Similar Messages

  • Error 500: ERROR: Cannot forward. Writer or Stream already obtained. Error

    hi
    i m unable to fugure out y I m getting this error
    it's a suggestion page and on submitting this page I have to reload the page but with status of the page (requires approval) in form of url
    earlier say few days back , it was working fine , i had absolutely no issues in this
    since 2-3 days everytime i submit the page , i m getting the error
    Error 500: ERROR: Cannot forward. Writer or Stream already obtained. Error 500
    my code is listed below
    pls help
    <%@ include file="../includes/sessionChecker.jsp"%>
    <%@ page isThreadSafe="false" errorPage="../html/messError.jsp" %>
    <%@ page import="java.io.*,java.util.*,java.sql.*" %>
    <%@ page import="com.syntaxsoft.util.*" %>
    <%@ page import="com.syntaxsoft.util.DateUtil" %>
    <%@ page import="com.syntaxsoft.admin.*" %>
    <%@ page import="com.syntaxsoft.employee.*" %>
    <%@ page import="com.syntaxsoft.db.*" %>
    <%@ include file="../includes/cssJsInclude.jsp"%>
    <%@ taglib uri="QuinnoxTags" prefix="QuinnoxTags" %>
    <html>
    <head>
    <title>Suggestions</title>
    <meta http-equiv="Content-Type" content="xls/html; charset=iso-8859-1">
    <link href="../STYLESHEET/stylesheet.css" rel="stylesheet" type="text/css">
    </head>
    <body>
    <%!
         Table sqltab;
         SqlBuilder sqlObj;
    %>
    <%
         String dofc = "",subject="",suggestion = "",docsrno="",actions="";
         String pick_button = "",locateid = "",employid="",url="";
         String employeeid="";
         String tabname=" ";
         boolean success = false;
         ResultSet rs= null;
    %>
    <%
         employid = (String) session.getAttribute("empid");
         locateid = (String) session.getAttribute("locationid");
         Employee empobj = Employee.getEmployee(employid);
         DateUtil dateform = new DateUtil(locateid);
         actions = request.getParameter("actions");
         pick_button = request.getParameter("DECISION");
         System.out.println("ACTION"+actions);
         System.out.println("pick_button"+pick_button);
    %>     
    <body>
    <%
         if(actions.equals("create")){
              if(pick_button == null){
    %>     
                   <form name="form1" method="post" action="../HRFiles/Suggestions.jsp">
                        <input type="hidden" name="actions" value="<%=actions%>">
                   <div class="page_heading">Suggestion Box</div><br>
                   <table>
                        <tr><th>From:</th><td><%=empobj.getFullName()%></td></tr>
                        <tr><th>Dated:</th><td><%=dateform.getToday()%></td></tr>
                        <tr><th>Subject</th><td><QuinnoxTags:TextBox type="text" name="subject" maxLength="65" required="true" value=" " label="Subject"/></td></tr>
                        <tr><th colspan="2">Suggestion:</th></tr>
                        <tr><td colspan="2"><QuinnoxTags:TextBox name="suggestion" type="textarea" cols="60" rows="13" required="true" value=" " label="Suggestion" maxLength="250"/></td></tr>
                   </table><br>
                   <table>
              <tr>
                   <td align="right">
                        <input type="submit" name="DECISION" value="Submit" class="button">
                   </td>
              </tr>
         </table>
                   <input type="hidden" name="empid" value="<%=employid%>"
                   <jsp:include page="../masters/flow.jsp" flush="true">
                        <jsp:param name="CREATOR" value="true"/>
                        <jsp:param name="TABNAME" value="SUGGESTION_WKFLOW"/>
                   </jsp:include>               
    <!--               <table>
                        <tr><td align="right"><input type="submit" name="submit" value="Submit" class='button'></td></tr>
                   </table>-->
              </form>
    <%
              else{
                   dofc          = dateform.getTodayMillis()+"";
                   subject          = request.getParameter("subject");          
                   suggestion     = request.getParameter("suggestion");
                   tabname =request.getParameter("TABNAME");          
                   // insert into SUGGESTIONS
                   // generate key
                   IDs idObj = IDs.getIDs();
                   docsrno = idObj.getId("SUGGESTIONID");
                   sqlObj=new SqlBuilder("SUGGESTIONS");
                   sqlObj.setColumn("DOCSLNO",docsrno);
                   sqlObj.setColumn("EMPID",employid);
                   sqlObj.setColumn("DOFC",dofc);
                   sqlObj.setColumn("DOFCZONE",locateid);
                   sqlObj.setColumn("SUBJECT",tabname);
                   sqlObj.setColumn("SUGGESTION",suggestion);
    //          System.out.println("empid is "+request.getParameter("empid"));
                   System.out.println("empid is "+employid);
                   success = sqlObj.set(SqlBuilder.INSERT);
    %>                         
                   <jsp:include page="../masters/flow1.jsp" flush="true">
                        <jsp:param name="DECISION" value="<%=request.getParameter(com.syntaxsoft.admin.WorkFlow.DECISION)%>" />
                        <jsp:param name="empid" value="<%=request.getParameter(\"empid\")%>" />
                        <jsp:param name="VIEWLEVEL" value="<%=request.getParameter(com.syntaxsoft.admin.WorkFlow.VIEWLEVEL)%>" />
                        <jsp:param name="VIEWERID" value="<%=request.getParameter(com.syntaxsoft.admin.WorkFlow.VIEWERID)%>" />
                        <jsp:param name="COMMENTS" value="<%=request.getParameter(com.syntaxsoft.admin.WorkFlow.COMMENTS)%>" />
                        <jsp:param name="DOCSLNO" value="<%=docsrno%>"/>
                        <jsp:param name="CREATOR" value="true"/>
                        <jsp:param name="TABNAME" value="<%=request.getParameter(\"TABNAME\")%>" />
                        <jsp:param name="MASTER_TABLE" value="SUGGESTIONS" />
                   </jsp:include>
                   <jsp:include page="../includes/redirectInclude.jsp" flush="true">
                        <jsp:param name="url" value="../HRFiles/ViewSuggestion.jsp?flag=empview" />
                   </jsp:include>
    <%
              } // end of if(pick_button == null)
         } // end of if(actions == create)
         if(actions.equals("select")){
              rs = sqltab.select("select * from SUGGESTIONS");
              if(rs.next()){
    %>
                   <div class="page_heading">List of Suggestions</div><br>
                   <table>
                        <tr>
                             <th>Employee Id</th>
                             <th>Employee Name</th>
                             <th>Suggestion Date</th>
                             <th>Subject</th>
                        </tr>
    <%          
                   do{
                        docsrno = rs.getString("DOCSLNO");
                        employeeid = rs.getString("EMPID");
                        dofc = rs.getString("DOFC");
                        subject = rs.getString("SUBJECT");
                        Employee empobj1 = Employee.getEmployee(employeeid);
                        url = "../HRFiles/Suggestions.jsp?actions=view&docsrno="+docsrno;
    %>
                        <tr>
                             <td><a href="<%=url%>"><%=employeeid%></a></td>
                             <td><a href="<%=url%>"><%=empobj1.getFullName()%></a></td>
                             <td><a href="<%=url%>"><%=dateform.getDate(dofc)%></a></td>
                             <td><a href="<%=url%>"><%=subject%></a></td>
                        </tr>                    
    <%               
                   }while(rs.next());
              } // end of if
         } // end of if(actions == select)
         if(actions.equals("view")){
              docsrno = request.getParameter("docsrno");
              rs = sqltab.select("select * from SUGGESTIONS where DOCSLNO='"+docsrno+"'");
              if(rs.next()){
                   do{
                        docsrno = rs.getString("DOCSLNO");
                        employeeid = rs.getString("EMPID");
                        dofc = rs.getString("DOFC");
                        subject = rs.getString("SUBJECT");
                        suggestion = rs.getString("SUGGESTION");
                   }while(rs.next());
              } // end of if()
              Employee empobj2 = Employee.getEmployee(employeeid);
    %>
              <div class="page_heading">Suggestion Box</div><br>
              <table>
                   <tr><th>From:</th><td><%=empobj2.getFullName()%></td></tr>
                   <tr><th>Dated:</th><td><%=dateform.getDate(dofc)%></td></tr>
                   <tr><th>Subject</th><td><%=subject%></td></tr>
                   <tr><th colspan="2">Suggestion:</th></tr>
                   <tr><td colspan="2"><textarea name="suggestion" cols="70" rows="10" readonly><%=suggestion%></textarea></td></tr>
              </table><br>
              <table>
                   <tr><td colspan="4" align="right">Back</td></tr>
              </table>
    <%     
         } // end of if(actions == view)
    %>
    </body>
    </html>
    rgds

    The problem is that you are trying to do a forward somewhere when output has already been sent to the browser: this is not allowed. I cannot find it in your code, so it must be in one of the includes.

  • Java.lang.IllegalStateException: Cannot forward. Response already committed

    i have deployed my application on Websphere application server 5.0. most of the time my jsp page works properly with any exception, but somtime it give me expeception and display page uncompletely rendered.
    Follwoing exception occure on particual page with particular record and same page works correctly with other reocrds....
    java.lang.IllegalStateException: Cannot forward. Response already committed. (Servlet 2.3, SRV 8.4)
         at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:160)
         at com.mcb.cpms.presentation.controllers.CPMSController.dispatchRequest(CPMSController.java:918)
         at com.mcb.cpms.presentation.controllers.CPMSController.doGet(CPMSController.java:1278)
         at com.mcb.cpms.presentation.controllers.CPMSController.doPost(CPMSController.java:1308)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at com.ibm.ws.webcontainer.servlet.StrictServletInstance.doService(StrictServletInstance.java:110)
         at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._service(StrictLifecycleServlet.java:174)
         at com.ibm.ws.webcontainer.servlet.IdleServletState.service(StrictLifecycleServlet.java:313)
         at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.service(StrictLifecycleServlet.java:116)
         at com.ibm.ws.webcontainer.servlet.ServletInstance.service(ServletInstance.java:283)
         at com.ibm.ws.webcontainer.servlet.ValidServletReferenceState.dispatch(ValidServletReferenceState.java:42)
         at com.ibm.ws.webcontainer.servlet.ServletInstanceReference.dispatch(ServletInstanceReference.java:40)
         at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java:948)
         at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:530)
         at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:176)
         at com.ibm.ws.webcontainer.srt.WebAppInvoker.doForward(WebAppInvoker.java:79)
         at com.ibm.ws.webcontainer.srt.WebAppInvoker.handleInvocationHook(WebAppInvoker.java:201)
         at com.ibm.ws.webcontainer.cache.invocation.CachedInvocation.handleInvocation(CachedInvocation.java:71)
         at com.ibm.ws.webcontainer.cache.invocation.CacheableInvocationContext.invoke(CacheableInvocationContext.java:114)
         at com.ibm.ws.webcontainer.srp.ServletRequestProcessor.dispatchByURI(ServletRequestProcessor.java:186)
         at com.ibm.ws.webcontainer.oselistener.OSEListenerDispatcher.service(OSEListener.java:334)
         at com.ibm.ws.webcontainer.http.HttpConnection.handleRequest(HttpConnection.java:56)
         at com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java:610)
         at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:431)
         at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:593)
    i will be thankfull if any one have any idea about it.....
    waiting for your immediate response

    Hi Junaid,
    Your code can be work correctly on different servers or with other records but it can not be handled with buffer or autoflush,
    I had same problem a few weeks ago. And lastly I had to control before printing any output. My application was working on WebSphere but not on Tomcat, so it is general problem.
    The only way if you have to put some output before sending redirect:
    When you want to redirect the page, write window.location = ... (javascript code).
    When page is loaded automatically will be redirected to the page you want. But of course it is a bit slow.
    Good Luck,
    isturk.

  • Cannot forward a response that is already committed  exeption after Log out

    Hello,
    I am using Jdeveloper 11.1.1.3.0, ADF DC, ADF Faces, ADF security.
    I have a logout button in my template, and I want the user to go back to login page (login.html; which was generated automaticlly when you use ADF security) after successful Log out.
    here is my logout method
        public String doLogOut() throws IOException {
            // Add event code here...
            ExternalContext ectx =
                FacesContext.getCurrentInstance().getExternalContext();
            HttpServletResponse response = (HttpServletResponse)ectx.getResponse();
            HttpSession session = (HttpSession)ectx.getSession(false);
            session.invalidate();
            response.sendRedirect("login.html");
            return null;      
        }when I click the log out button, every thing seems ok, and the user redirected to login.html page. However, I see the following Exception in Jdeveloper Log window.
    <Jan 4, 2012 12:16:31 PM EET> <Error> <HTTP> <BEA-101020> <[ServletContext@19059163[app:CTP-New module:CTP-New-ViewController-context-root path:/CTP-New-ViewController-context-root spec-version:2.5 version:V2.0]] Servlet failed with Exception
    java.lang.IllegalStateException: Cannot forward a response that is already committed
         at weblogic.servlet.internal.RequestDispatcherImpl.forward(RequestDispatcherImpl.java:122)
         at com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:410)
         at org.apache.myfaces.trinidad.context.ExternalContextDecorator.dispatch(ExternalContextDecorator.java:44)
         at org.apache.myfaces.trinidad.context.ExternalContextDecorator.dispatch(ExternalContextDecorator.java:44)
         at org.apache.myfaces.trinidad.context.ExternalContextDecorator.dispatch(ExternalContextDecorator.java:44)
         Truncated. see log file for complete stacktrace
    >
    <Jan 4, 2012 12:16:31 PM EET> <Notice> <Diagnostics> <BEA-320068> <Watch 'UncheckedException' with severity 'Notice' on server 'DefaultServer' has triggered at Jan 4, 2012 12:16:31 PM EET. Notification details:
    WatchRuleType: Log
    WatchRule: (SEVERITY = 'Error') AND ((MSGID = 'BEA-101020') OR (MSGID = 'BEA-101017') OR (MSGID = 'BEA-000802'))
    WatchData: DATE = Jan 4, 2012 12:16:31 PM EET SERVER = DefaultServer MESSAGE = [ServletContext@19059163[app:CTP-New module:CTP-New-ViewController-context-root path:/CTP-New-ViewController-context-root spec-version:2.5 version:V2.0]] Servlet failed with Exception
    java.lang.IllegalStateException: Cannot forward a response that is already committed
         at weblogic.servlet.internal.RequestDispatcherImpl.forward(RequestDispatcherImpl.java:122)
         at com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:410)
         at org.apache.myfaces.trinidad.context.ExternalContextDecorator.dispatch(ExternalContextDecorator.java:44)
         at org.apache.myfaces.trinidad.context.ExternalContextDecorator.dispatch(ExternalContextDecorator.java:44)
         at org.apache.myfaces.trinidad.context.ExternalContextDecorator.dispatch(ExternalContextDecorator.java:44)
         at org.apache.myfaces.trinidad.context.ExternalContextDecorator.dispatch(ExternalContextDecorator.java:44)
         at org.apache.myfaces.trinidadinternal.context.FacesContextFactoryImpl$OverrideDispatch.dispatch(FacesContextFactoryImpl.java:267)
         at com.sun.faces.application.ViewHandlerImpl.executePageToBuildView(ViewHandlerImpl.java:473)
         at com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:141)
         at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:189)
         at org.apache.myfaces.trinidadinternal.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:193)
         at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._renderResponse(LifecycleImpl.java:710)
         at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._executePhase(LifecycleImpl.java:273)
         at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:205)
         at javax.faces.webapp.FacesServlet.service(FacesServlet.java:266)
         at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
         at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
         at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)
         at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:191)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at oracle.adfinternal.view.faces.webapp.rich.RegistrationFilter.doFilter(RegistrationFilter.java:97)
         at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:420)
         at oracle.adfinternal.view.faces.activedata.AdsFilter.doFilter(AdsFilter.java:60)
         at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:420)
         at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:247)
         at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:157)
         at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:92)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:94)
         at java.security.AccessController.doPrivileged(Native Method)
         at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:313)
         at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:414)
         at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:138)
         at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:71)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at oracle.dms.wls.DMSServletFilter.doFilter(DMSServletFilter.java:330)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.doIt(WebAppServletContext.java:3684)
         at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3650)
         at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
         at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
         at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2268)
         at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2174)
         at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1446)
         at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
         at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
    SUBSYSTEM = HTTP USERID = <WLS Kernel> SEVERITY = Error THREAD = [ACTIVE] ExecuteThread: '11' for queue: 'weblogic.kernel.Default (self-tuning)' MSGID = BEA-101020 MACHINE = Mjabr-PC TXID =  CONTEXTID = 4b079561b4c220a0:10458ad0:134a7995c3f:-8000-0000000000000241 TIMESTAMP = 1325672191307 
    WatchAlarmType: AutomaticReset
    WatchAlarmResetPeriod: 30000
    >Further more when I try to login again, I get this message in the browser
    Error 403--Forbidden
    From RFC 2068 Hypertext Transfer Protocol -- HTTP/1.1:
    10.4.4 403 Forbidden
    The server understood the request, but is refusing to fulfill it. Authorization will not help and the request SHOULD NOT be repeated. If the request method was not HEAD and the server wishes to make public why the request has not been fulfilled, it SHOULD describe the reason for the refusal in the entity. This status code is commonly used when the server does not wish to reveal exactly why the request has been refused, or when no other response is applicable.Any help is highly appreciated.

    Thank you ADF7,
    I used this method
        public String doLogOut() throws IOException {
            // Add event code here...
            FacesContext ctx = FacesContext.getCurrentInstance();
            HttpServletRequest request =
                (HttpServletRequest)ctx.getExternalContext().getRequest();
            ExternalContext ectx =
                FacesContext.getCurrentInstance().getExternalContext();
            try {
                ectx.redirect(request.getContextPath() +
                              "/login.html");
            } catch (Exception exp) {
                exp.printStackTrace();
            return null;
        }but when I re login again I get the same error in the browser
    Error 403--Forbidden
    From RFC 2068 Hypertext Transfer Protocol -- HTTP/1.1:
    10.4.4 403 Forbidden
    The server understood the request, but is refusing to fulfill it. Authorization will not help and the request SHOULD NOT be repeated. If the request method was not HEAD and the server wishes to make public why the request has not been fulfilled, it SHOULD describe the reason for the refusal in the entity. This status code is commonly used when the server does not wish to reveal exactly why the request has been refused, or when no other response is applicable.

  • Javax.servlet.jsp.JspException: Cannot forward a response that is already committed at

              Hello,
              Went through the article
              http://dev2dev.bea.com/articles/platform7_feature.jsp
              I thought if you have a workaround for the following issue.
              Any help to solve this issue is much appreciated.
              thx,
              -Sujatha.
              I am using JATO framework and have developed JSP's.
              Running an application on top of weblogic 6.1 sp4 container.
              The OS is Solaris 5.8.
              Every time i access the jsp's, getting the following exception.
              java.lang.IllegalStateException: Cannot forward a response that is
              already committed
              at
              weblogic.servlet.internal.RequestDispatcherImpl.forward(RequestDispatcherImpl.java:132)
              at
              com.iplanet.jato.view.ViewBeanBase.forward(ViewBeanBase.java:346)
              at
              com.iplanet.jato.view.ViewBeanBase.forwardTo(ViewBeanBase.java:267)
              at
              com.iplanet.am.console.base.ConsoleServletBase.onUncaughtException(ConsoleServletBase.java:240)
              at
              com.iplanet.jato.ApplicationServletBase.fireUncaughtException(ApplicationServletBase.java:1023)
              at
              com.iplanet.jato.ApplicationServletBase.processRequest(ApplicationServletBase.java:469)
              at
              com.iplanet.jato.ApplicationServletBase.doPost(ApplicationServletBase.java:324)
              at
              com.iplanet.jato.ApplicationServletBase.doGet(ApplicationServletBase.java:294)
              at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
              at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
              at
              weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:262)
              at
              weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:198)
              at
              weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:2637)
              at
              weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2359)
              at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
              at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
              

    sorry, but just to make a additional note.
    the <c:import > tag library is from JSTL taglib <%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
    regards,
    Junecello

  • WAS 6.0 - Response already committed / OutputStream already obtained

    Hello, we have struts code that is working fine in websphere 5, but not 6. I've seen this same kind of thing being post around, but haven't found one that closely resembles our simple setup. Below I've copied what our code looks like. Please help me to understand what the least-intrusive way would be to fix something simple like this, and let me know if more info is needed. FYI, we have tried returning null from the class, but this doens't seem to work. Also, some additional info is that we need this to work in WAS 5 and 6, because we have two different apps containing the same code, one of which is deployed (via EAR file) on 5 and the other 6. Thanks!
    struts-config entry:     
    <action path="/streamFile" type="MyClass" scope="request" validate="false">
                  <forward name="success" path=""/>
    </action>     
    web.xml entry:
         <servlet-mapping>
              <servlet-name>opsconsoleServlet</servlet-name>
              <url-pattern>streamFile</url-pattern>
         </servlet-mapping>
    Snippet of Class file:
    public class MyClass extends Action {
         public ActionForward execute(ActionMapping mapping,
                         ActionForm form,
                        HttpServletRequest request,
                        HttpServletResponse response)
              throws Exception {    
         ServletOutputStream out = response.getOutputStream();
         BufferedOutputStream bos = null;
         try {
                   bos = new BufferedOutputStream(out);
                    bos.write(<bytes, etc>);
         } catch(final MalformedURLException e) {
         throw e;
         } catch(final IOException e) {
         throw e;
         } finally {
         if (bos != null)
              bos.close();
         if (out != null)
              out.close();
         return mapping.findForward("success");
    error from log:
    [11/5/07 12:50:11:737 EST] 00000036 ServletWrappe E   SRVE0014E: Uncaught service() exception root cause FilterProxyServlet: Cannot forward. Response already committed.
    [11/5/07 12:50:12:001 EST] 00000036 ServletWrappe E   SRVE0068E: Could not invoke the service() method on servlet opsconsoleServlet. Exception thrown : javax.servlet.ServletException: Cannot forward. Response already committed.
            at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:157)
            at com.ibm.ws.webcontainer.filter.WebAppFilterChain._doFilter(WebAppFilterChain.java:82)
    error later in log:
    [11/5/07 12:50:12:621 EST] 00000036 SRTServletRes W   WARNING: Cannot set status. Response already committed.
    [11/5/07 12:50:12:627 EST] 00000036 SRTServletRes W   WARNING: Cannot set header. Response already committed.
    [11/5/07 12:50:14:191 EST] 00000036 ServletWrappe A   SRVE0242I: [Communication] [/OpsConsole] [/WEB-INF/jsp/error/internalError.jsp]: Initialization successful.
    [11/5/07 12:50:14:201 EST] 00000036 ServletWrappe E   SRVE0068E: Could not invoke the service() method on servlet /WEB-INF/jsp/error/internalError.jsp. Exception thrown : java.lang.IllegalStateException: SRVE0199E: OutputStream already obtained
            at com.ibm.ws.webcontainer.srt.SRTServletResponse.getWriter(SRTServletResponse.java:490)
            at org.apache.jasper.runtime.JspWriterImpl.initOut(JspWriterImpl.java:170)
            at org.apache.jasper.runtime.JspWriterImpl.flushBuffer(JspWriterImpl.java:163)
            at org.apache.jasper.runtime.PageContextImpl.release(PageContextImpl.java:227)

    svguerin3 :
    So this is something that worked in websphere 5 but not 6.. Are you sure this same code working on WAS5? This shouldn't. I guess you are trying to display the contents of the stream in a JSP page.If that's correct don't use
    ServletOutputStream out = response.getOutputStream();
         BufferedOutputStream bos = null;
         try {
                   bos = new BufferedOutputStream(out);
                    bos.write(<bytes, etc>);
         }instead read the bytes in to an in memory object, add this in memory object to request param and then call findForward(). In the JSP page get this request attribute and do whatever you want.
    Note: You can either use servletoutstream.write or RequestDispactcher.forward/redirect/response.sendRedirect.

  • Jsp:forward failed with 'Response already committed'

    I got a "Response already commited" error when using logic:forward or jsp:forward inside a JSP page fragment that is part of a Struts Tiles layout.
    Here is the code fragment included in the layout.jsp.
    <%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
    <logic:notPresent name="user" scope="session">
         <logic:forward name="login" />
    </logic:notPresent>
    Here is the error message:
    [ServletException in:/WEB-INF/tiles/verifyLogin.jsp] Exception forwarding for name login: java.lang.IllegalStateException: Cannot forward. Response already committed. (Servlet 2.3, SRV 8.4)'

    Jsp normally buffers output in a 8k buffer and write it to the output stream (i.e. "commits") it when:
    1) it is explicitly flushed
    2) the buffer overflow
    3) an jsp include is invoked
    My code is in a layout.jsp file which is referenced in a tiles-definition. The tiles definition is tiles:inserted in a top-level jsp file. I am not sure if tiles uses jsp:include or if there is a way to get jsp:foward to work in the layout.jsp.

  • Erro code:500 SRVE0199E: OutputStream already obtained

    Hi all Iam writing a JSP code for exporting the result in to the csv .It working perfectly but afte exporting results it is showing exeception on same csv file.Can any one help me.The exeception is shown bellow.
    Error page exception
    The server cannot use the error page specified for your application to handle the Original Exception printed below. Please see the Error Page Exception below for a description of the problem with the specified error page.
    Original Exception:
    Error Message: SRVE0199E: OutputStream already obtained
    Error Code: 500
    Target Servlet: /quantum/ExportToCsv.jsp
    Error Stack:
    java.lang.IllegalStateException: SRVE0199E: OutputStream already obtained
    " at com.ibm.ws.webcontainer.srt.SRTServletResponse.getWriter(SRTServletResponse.java(Compiled Code))"
    " at org.apache.jasper.runtime.JspWriterImpl.initOut(JspWriterImpl.java(Inlined Compiled Code))"
    " at org.apache.jasper.runtime.JspWriterImpl.flushBuffer(JspWriterImpl.java(Compiled Code))"
    " at org.apache.jasper.runtime.PageContextImpl.release(PageContextImpl.java(Compiled Code))"
    " at org.apache.jasper.runtime.JspFactoryImpl.internalReleasePageContext(JspFactoryImpl.java(Inlined Compiled Code))"
    " at org.apache.jasper.runtime.JspFactoryImpl.releasePageContext(JspFactoryImpl.java(Compiled Code))"
    " at com.ibm._jsp._ExportToCsv._jspService(_ExportToCsv.java:321)"
    " at com.ibm.ws.jsp.runtime.HttpJspBase.service(HttpJspBase.java(Compiled Code))"
    " at javax.servlet.http.HttpServlet.service(HttpServlet.java(Compiled Code))"
    " at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java(Compiled Code))"
    " at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java(Compiled Code))"
    " at com.ibm.wsspi.webcontainer.servlet.GenericServletWrapper.handleRequest(GenericServletWrapper.java(Inlined Compiled Code))"
    " at com.ibm.ws.jsp.webcontainerext.JSPExtensionServletWrapper.handleRequest(JSPExtensionServletWrapper.java(Compiled Code))"
    " at com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest(CacheServletWrapper.java(Compiled Code))"
    " at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java(Compiled Code))"
    " at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java(Compiled Code))"
    " at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java(Compiled Code))"
    " at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java(Compiled Code))"
    " at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java(Compiled Code))"
    " at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminaters(NewConnectionInitialReadCallback.java(Compiled Code))"
    " at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java(Compiled Code))"
    " at com.ibm.ws.tcp.channel.impl.WorkQueueManager.requestComplete(WorkQueueManager.java(Compiled Code))"
    " at com.ibm.ws.tcp.channel.impl.WorkQueueManager.attemptIO(WorkQueueManager.java(Compiled Code))"
    " at com.ibm.ws.tcp.channel.impl.WorkQueueManager.workerRun(WorkQueueManager.java(Compiled Code))"
    " at com.ibm.ws.tcp.channel.impl.WorkQueueManager$Worker.run(WorkQueueManager.java(Compiled Code))"
    " at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java(Compiled Code))"
    Error Page Exception:
    Error Message: SRVE0199E: OutputStream already obtained
    Error Code: 0
    Target Servlet: null
    Error Stack:
    java.lang.IllegalStateException: SRVE0199E: OutputStream already obtained
    " at com.ibm.ws.webcontainer.srt.SRTServletResponse.getWriter(SRTServletResponse.java(Compiled Code))"
    " at com.ibm.ws.webcontainer.webapp.WebApp.sendError(WebApp.java(Compiled Code))"
    " at com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest(CacheServletWrapper.java(Compiled Code))"
    " at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java(Compiled Code))"
    " at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java(Compiled Code))"
    " at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java(Compiled Code))"
    " at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java(Compiled Code))"
    " at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java(Compiled Code))"
    " at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminaters(NewConnectionInitialReadCallback.java(Compiled Code))"
    " at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java(Compiled Code))"
    " at com.ibm.ws.tcp.channel.impl.WorkQueueManager.requestComplete(WorkQueueManager.java(Compiled Code))"
    " at com.ibm.ws.tcp.channel.impl.WorkQueueManager.attemptIO(WorkQueueManager.java(Compiled Code))"
    " at com.ibm.ws.tcp.channel.impl.WorkQueueManager.workerRun(WorkQueueManager.java(Compiled Code))"
    " at com.ibm.ws.tcp.channel.impl.WorkQueueManager$Worker.run(WorkQueueManager.java(Compiled Code))"
    " at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java(Compiled Code))"

    java.lang.IllegalStateException: SRVE0199E: OutputStream already obtained
    " at com.ibm.ws.webcontainer.srt.SRTServletResponse.getWriter(SRTServletResponse.java(Compiled Code))" Read the API docs. You cannot get both OutputStream and Writer during one request-response cycle. Do the one or the other. The exception tells that you're trying to get the Writer while somewhere before that line the OutputStream is already been obtained.
    The solution is hopefully obvious: change your code so that it only get the Writer, or only the OutputStream, not both. I recommend getting the OutputStream all the time and don't even think about getting the Writer. Most API's also do it.

  • CatalogDeployer issue - "Cannot set header. Response already committed"

    Whenever we are trying to deploy any package we immediately get a 'deployment successful' message though the package is not deployed and remnains in the received for deployment queue. This is only found in the log 00000048 SRTServletRes W WARNING: Cannot set header. Response already committed.
    Very much appreciated if you could provide the resolution.
    We have a production service release tomorrow so we need assistance on this one asap. Thanks a lot

    You can not write to the response after you have forwarded the request to another servlet/JSP.

  • OutputStream already obtained

    Hi,
    I am working on an application that uses struts on websphere.
    I have written a code to download a file on click of a link. What it does is read the file and write it on an outputstream which I get from response object.
    It works but gives the error java.lang.IllegalStateException: OutputStream already obtained
    Now I know why this happening, you cannot get both outputstream and printwriter from same response object.
    What I need is solution to get rid of this nasty error.
    Please help... this is very critical and I am stuck up.
    I tried looking at the net... but could not find any solution.
    Thanks in advance,
    Rana

    Very simple.
    Don't call getOuputStream() if you have already called getWriter().
    You're writing a servlet, so you have full control over the code.
    If you are writing it in JSP, make sure you have no text/carriage returns outside of <% %> tags.
    ie
    <%@page import="..."%>
    <%@page import="..."%>
    <% response.getOutputStream() %>
    is bad because it gets the writer, has already been got, and written carriage returns before you call getOutputStream().
    Hope this helps,
    evnafets

  • HT201317 I have a PC with Windows Vista but I cannot find my photo stream anywhere. I followed the directions on the FAQ but it led me nowhere. What do I do?

    I have a PC with Windows Vista but I cannot find my photo stream anywhere. I followed the directions on the FAQ but it led me nowhere. What do I do?

    Well I linked to an article produced and hosted by Apple so I suppose if they have an issue with it the would have to spank themselves
    In addition the US Supreme Court has ruled that making a copy of a DVD for personal use or as a backup is perfectly legal, we've been doing that with CDs for as long as it has been possible, same for video tapes.
    What is illegal is breaking any DRM protection on the media (this holds true for all media not just DVDs) and actually even this is a bit murky. What is definitely illegal is to sell software to break DRM.  However if you write your own DRM breaking software and use it to make personal copies or backups the law gets real gray.
    So again as long as there is no DRM involved its OK, with DRM you're best to leave it alone.
    regards

  • Java.lang.IllegalStateException: Cannot forward a response that is

              Hello,
              Went through the article
              http://dev2dev.bea.com/articles/platform7_feature.jsp
              I thought if you have a workaround for the following issue.
              Any help to solve this issue is much appreciated.
              thx,
              -Sujatha.
              I am using JATO framework and have developed JSP's.
              Running an application on top of weblogic 6.1 sp4 container.
              The OS is Solaris 5.8.
              Every time i access the jsp's, getting the following exception.
              java.lang.IllegalStateException: Cannot forward a response that is
              already committed
              at
              weblogic.servlet.internal.RequestDispatcherImpl.forward(RequestDispatcherImpl.java:132)
              at
              com.iplanet.jato.view.ViewBeanBase.forward(ViewBeanBase.java:346)
              at
              com.iplanet.jato.view.ViewBeanBase.forwardTo(ViewBeanBase.java:267)
              at
              com.iplanet.am.console.base.ConsoleServletBase.onUncaughtException(ConsoleServletBase.java:240)
              at
              com.iplanet.jato.ApplicationServletBase.fireUncaughtException(ApplicationServletBase.java:1023)
              at
              com.iplanet.jato.ApplicationServletBase.processRequest(ApplicationServletBase.java:469)
              at
              com.iplanet.jato.ApplicationServletBase.doPost(ApplicationServletBase.java:324)
              at
              com.iplanet.jato.ApplicationServletBase.doGet(ApplicationServletBase.java:294)
              at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
              at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
              at
              weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:262)
              at
              weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:198)
              at
              weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:2637)
              at
              weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2359)
              at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
              at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
              

    thank you  dvohra21  the application is deployed in development .Its not session inactivity because this happen when l'm busy using the application ,reducing the application speed .

  • SRVE0199E: OutputStream already obtained when exporting pdf

    Hi,
    I am have a problem when export pdf file from a web application. When I build with tomcat every works fine, but when deployed in Websphere. The problem occurred. It is that the exception stack being attached at the end of pdf file which prevents Adobe Acrobat 7 from open and displaying message like the file is damaged and could not be repaired. This is the exception stack,
    <H1>Error page exception</H1>
    <H4>The server cannot use the error page specified for your application to handle the Original Exception printed below. Please see the Error Page Exception below for a description of the problem with the specified error page.</H4>
    <BR><H3>Original Exception: </H3>
    <B>Error Message: </B>SRVE0199E: OutputStream already obtained<BR>
    <B>Error Code: </B>500<BR>
    <B>Target Servlet: </B>action<BR>
    <B>Error Stack: </B><BR>
    java.lang.IllegalStateException: SRVE0199E: OutputStream already obtained
    <BR>    
         at com.ibm.ws.webcontainer.srt.SRTServletResponse.getWriter&#40;SRTServletResponse.java&#40;Compiled Code&#41;&#41;
    <BR>    
         at org.apache.jasper.runtime.JspWriterImpl.initOut&#40;JspWriterImpl.java&#40;Inlined Compiled Code&#41;&#41;
    <BR>    
         at org.apache.jasper.runtime.JspWriterImpl.flushBuffer&#40;JspWriterImpl.java&#40;Compiled Code&#41;&#41;
    <BR>    
         at org.apache.jasper.runtime.PageContextImpl.release&#40;PageContextImpl.java&#40;Compiled Code&#41;&#41;
    <BR>    
         at org.apache.jasper.runtime.JspFactoryImpl.internalReleasePageContext&#40;JspFactoryImpl.java&#40;Inlined Compiled Code&#41;&#41;
    <BR>    
         at org.apache.jasper.runtime.JspFactoryImpl.releasePageContext&#40;JspFactoryImpl.java&#40;Compiled Code&#41;&#41;
    <BR>    
         at com.ibm._jsp._exportResults._jspService&#40;_exportResults.java:104&#41;
    <BR>    ... there is more...
    and my code that generate pdf is,
    try {
    out = res.getOutputStream();
    PdfWriter.getInstance(document, out);
    document.open();
    Paragraph para = null;
    para = new Paragraph("Title", FontFactory.getFont("Arial", 20,Font.BOLD));
    document.add(para);
    } catch (DocumentException e1) {
    e1.printStackTrace();
    } catch (IOException e1) {
    e1.printStackTrace();
    document.close();
    please help me out because this is an urgent issue. Thanks.

    I didn't put this code within JSP, but inside javax.servlet.jsp.tagext.TagSupport. Is this the same as in JSP?
    While waiting for the answer, I also find that in TagSupport, there is a member variable, pageContext, that also has pageContext.getOut() which is a JspWriter. This is used to export to excel. But for exporting to pdf, i used PdfWriter.getInstance(document, res.getOutputStream()); and res = pageContext.getResponse();
    is this the main reason?

  • Cannot start mwa audio streaming from web site

    Dear all,
    I found that i cannot open a wma audio streaming from web sit. Safari popup a error message that the mime audio type is not available. Although I've already installed flip4mac and Media Player 9, both Safari/Firefox cannot playing such audio stream. Is it a plug-ins issue and how can I to check and resolve this? Please help.
    Eric

    Jeremy Williams wrote:
    > I am looking for a free, or not-so-free script or
    Dreamweaver extention that
    > will enable me to progressively stream mp3 music on my
    web pages, but one that
    > does not start playing unless you press a play button.
    Also, it would be nice
    > if it had other control buttons.
    >
    > If anyone is aware of anything like this, I sure would
    appreciate it!
    > Thank you in advance!!
    >
    This one is cool ($34):
    http://www.coffeecup.com/web-jukebox/
    (Warning, song starts playing when you browse there)
    Bonnie
    in California
    8 ^ )

  • TS2972 I can get my music, movies and tv shows to play through my apple tv, but I cannot see my photo stream on my apple tv.  What can I do to get my photos to show up on the TV?

    I can get my music, movies and tv shows to play through my apple tv, but I cannot see my photo stream on my apple tv.  What can I do to get my photos to show up on the TV?
    I have a mac and wireless internet.

    Because you've got music and movies streaming to your Apple TV, I know you've authorized Home Sharing under the file menu of iTunes.  But under that same iTunes file menu you must also go to the "Home Sharing" pull-down and select "Choose Photos to Share With Apple TV". You can select All photos, or just specific albums. Maybe worth saying again that this is done from iTunes and not iPhoto.
    If you've already done this and still no photos on AppleTV, check to see that your photo file names (previously imported into iPhoto) have valid suffixes (such as photo.jpg).  Without that valid suffix, iPhoto on your Mac will show the photo just fine (courtesy of the hidden Type Code embedded in the photo file), but AppleTV will not.
    Good luck and let me know if either of these worked.

Maybe you are looking for