Is there Patch for 4.1 PageContextImpl unhandled IllegalStateException?
Hello Tomcat Users and Committers,Platform: Tomcat 4.1, Linux ES 2.1, jdk1.4.1.06Here is a snippet of the stack trace we regularly in our Tomcat 4.1.24 logs.- Root Cause -java.lang.IllegalStateException: getOutputStream() has already been called for this responseat org.apache.catalina.connector.ResponseBase.getWriter(ResponseBase.java:756) at org.apache.catalina.connector.ResponseFacade.getWriter(ResponseFacade.java:174) at org.apache.jasper.runtime.JspWriterImpl.initOut(JspWriterImpl.java:173) at org.apache.jasper.runtime.JspWriterImpl.flushBuffer(JspWriterImpl.java:166) at org.apache.jasper.runtime.PageContextImpl.release(PageContextImpl.java:184) at org.apache.jasper.runtime.JspFactoryImpl.internalReleasePageContext(JspFactoryImpl.java:198) at org.apache.jasper.runtime.JspFactoryImpl.releasePageContext(JspFactoryImpl.java:193) at org.apache.jsp.ViewAttachment_jsp._jspService(ViewAttachment_jsp.java:76) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:137) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:210) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:684) at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:432) at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:356)We intend to migrate to Tomcat 5.x later this year. In the interim, we recently linked this exception event to leaked memory. That is, the PageContextImpl.release() method (6th from top in stack trace, body below) never completes as it does not catch the IllegalStateException that happens when ResponseBase.getWriter()is called in the scope of flushBuffer(). public void release() {out = baseOut;try { if (isIncluded) { ((JspWriterImpl)out).flushBuffer();// push it into the including jspWriter } else {// Do not flush the buffer even if we're not included (i.e.// we are the main page. The servlet will flush it and close// the stream. ((JspWriterImpl)out).flushBuffer();} } catch (IOException ex) { loghelper.log(Internal error flushing the buffer in release()); } servlet = null;config = null;context = null; needsSession = false; errorPageURL = null;bufferSize = JspWriter.DEFAULT_BUFFER;autoFlush= true;request = null; response = null;depth = -1; baseOut.recycle(); session = null;attributes.clear();}The tear-down activity session=null is skipped because of the exception, which creates a problem since the session so referenced becomes ineligible for garbage collection after processing the request.Does anyone know:a) is this documented somewhere (I read 102 matches for memory leak on the Tomcat 4.1 list archives, but I did not find this exact problem, except for an entry in the 4.1 release notes where it is reported fixed in 4.1.20).b) is there a patch available to fix this in Tomcat 4.x?Thanks very much for your time,
Is there Patch for 4.1 PageContextImpl unhandled IllegalStateException?
Hello Tomcat Users and Committers, [duplicate as first msg got formatted incorrectly]Platform: Tomcat 4.1.24, Linux ES 2.1, jdk1.4.1.06Here is a snippet of the stack trace we regularly in our Tomcat 4.1.24 logs.- Root Cause -java.lang.IllegalStateException: getOutputStream() has already been called for this responseat org.apache.catalina.connector.ResponseBase.getWriter(ResponseBase.java:756) at org.apache.catalina.connector.ResponseFacade.getWriter(ResponseFacade.java:174) at org.apache.jasper.runtime.JspWriterImpl.initOut(JspWriterImpl.java:173) at org.apache.jasper.runtime.JspWriterImpl.flushBuffer(JspWriterImpl.java:166) at org.apache.jasper.runtime.PageContextImpl.release(PageContextImpl.java:184) at org.apache.jasper.runtime.JspFactoryImpl.internalReleasePageContext(JspFactoryImpl.java:198) at org.apache.jasper.runtime.JspFactoryImpl.releasePageContext(JspFactoryImpl.java:193) at org.apache.jsp.ViewAttachment_jsp._jspService(ViewAttachment_jsp.java:76)We intend to migrate to Tomcat 5.x later this year. In the interim, we recently linked this exception event to leaked memory. That is, the PageContextImpl.release() method (6th from top in stack trace above, body below) never completes as it does not catch the IllegalStateException that happens when ResponseBase.getWriter()is called in the scope of 2nd flushBuffer() call below.See org.apache.jasper.runtime.PageContextImpl:public void release() {out = baseOut;try {if (isIncluded) { ((JspWriterImpl)out).flushBuffer();// push it into the including jspWriter} else {// Do not flush the buffer even if we're not included (i.e.// we are the main page. The servlet will flush it and close// the stream. ((JspWriterImpl)out).flushBuffer();}} catch (IOException ex) { loghelper.log(Internal error flushing the buffer in release());}servlet = null;config = null;context = null;needsSession = false;errorPageURL = null;bufferSize = JspWriter.DEFAULT_BUFFER;autoFlush = true;request = null;response = null; depth = -1;baseOut.recycle();session = null;attributes.clear();}The 2nd last line above, session=null is skipped because of the uncaught exception, which creates a problem since a session so referenced becomes ineligible for garbage collection after processing the request.Does anyone know:a) is this a documented limitation (I read 102 matches for memory leak on the Tomcat 4.1 list archives, but I did not find this exact problem, except for an entry in the 4.1 release notes where it is reported fixed in 4.1.20).b) is there a patch available to fix this in Tomcat 4.x?Thanks very much for your time,Matthew
Re: Is there Patch for 4.1 PageContextImpl unhandled IllegalStateException?
Hmm. Looks like PageContextImpl.release() code could do with a clean up ;) Ignoring that for now, do you have any idea what is calling getOutputStream()? Is it called in ViewAttachment.jsp? Mark [EMAIL PROTECTED] wrote: Hello Tomcat Users and Committers,Platform: Tomcat 4.1, Linux ES 2.1, jdk1.4.1.06 Here is a snippet of the stack trace we regularly in our Tomcat 4.1.24 logs. - Root Cause - java.lang.IllegalStateException: getOutputStream() has already been called for this response at org.apache.catalina.connector.ResponseBase.getWriter(ResponseBase.java:756) at org.apache.catalina.connector.ResponseFacade.getWriter(ResponseFacade.java:174) at org.apache.jasper.runtime.JspWriterImpl.initOut(JspWriterImpl.java:173) at org.apache.jasper.runtime.JspWriterImpl.flushBuffer(JspWriterImpl.java:166) at org.apache.jasper.runtime.PageContextImpl.release(PageContextImpl.java:184) at org.apache.jasper.runtime.JspFactoryImpl.internalReleasePageContext(JspFactoryImpl.java:198) at org.apache.jasper.runtime.JspFactoryImpl.releasePageContext(JspFactoryImpl.java:193) at org.apache.jsp.ViewAttachment_jsp._jspService(ViewAttachment_jsp.java:76) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:137) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:210) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:684) at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:432) at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:356) We intend to migrate to Tomcat 5.x later this year. In the interim, we recently linked this exception event to leaked memory. That is, the PageContextImpl.release() method (6th from top in stack trace, body below) never completes as it does not catch the IllegalStateException that happens when ResponseBase.getWriter()is called in the scope of flushBuffer(). public void release() { out = baseOut; try { if (isIncluded) { ((JspWriterImpl)out).flushBuffer(); // push it into the including jspWriter } else { // Do not flush the buffer even if we're not included (i.e. // we are the main page. The servlet will flush it and close // the stream. ((JspWriterImpl)out).flushBuffer(); } } catch (IOException ex) { loghelper.log(Internal error flushing the buffer in release()); } servlet = null; config = null; context = null; needsSession = false; errorPageURL = null; bufferSize = JspWriter.DEFAULT_BUFFER; autoFlush= true; request = null; response = null; depth = -1; baseOut.recycle(); session = null; attributes.clear(); } The tear-down activity session=null is skipped because of the exception, which creates a problem since the session so referenced becomes ineligible for garbage collection after processing the request.Does anyone know: a) is this documented somewhere (I read 102 matches for memory leak on the Tomcat 4.1 list archives, but I did not find this exact problem, except for an entry in the 4.1 release notes where it is reported fixed in 4.1.20). b) is there a patch available to fix this in Tomcat 4.x? Thanks very much for your time, - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Is there Patch for 4.1 PageContextImpl unhandled IllegalStateException?
Hi Mark, Thanks for your quick response. The string 'getOutputStream' actually is retrieved from org/apache/catalina/connector/LocalStrings.properties using key 'responseBase.getWriter.ise' by org.apache.catalina.ResponseBase.getWriter(). getOutputStream() is called from org.apache.jasper.runtime.JspWriterImpl.initOut() which is called from same class flushBuffer() method. flushBuffer() is in turn called by PageContextImpl.release() which is method I included in my previous email. The ViewAttachment.jsp (8th line down in the prev. stack trace) is the where the problem originates. This JSP writes to output stream the file attachment, but since the JSP already has an output stream active, this causes the exception (I think.) I could rewrite the application as a servet, as a fix. However, before doing that I wanted to find out if the memory leak is: a) a known limitation b) whether a patch is available for example to add a finally block to PageContextImpl. release() which would solve the leak problem. Thanks, Matthew Original Message From: [EMAIL PROTECTED] Date: May 30, 2005 9:07:35 PM To: Tomcat Users List tomcat-user@jakarta.apache.org Subj: Re: Is there Patch for 4.1 PageContextImpl unhandled IllegalStateException? Hmm. Looks like PageContextImpl.release() code could do with a clean up ;) Ignoring that for now, do you have any idea what is calling getOutputStream()? Is it called in ViewAttachment.jsp? Mark [EMAIL PROTECTED] wrote: Hello Tomcat Users and Committers,Platform: Tomcat 4.1, Linux ES 2.1, jdk1.4.1.06 Here is a snippet of the stack trace we regularly in our Tomcat 4.1.24 logs. - Root Cause - java.lang.IllegalStateException: getOutputStream() has already been called for this response at org.apache.catalina.connector.ResponseBase.getWriter(ResponseBase.java: 756) at org.apache.catalina.connector.ResponseFacade.getWriter(ResponseFacade.java:174) at org.apache.jasper.runtime.JspWriterImpl.initOut(JspWriterImpl.java:173) at org.apache.jasper.runtime.JspWriterImpl.flushBuffer(JspWriterImpl.java: 166) at org.apache.jasper.runtime.PageContextImpl.release(PageContextImpl.java:184) at org.apache.jasper.runtime.JspFactoryImpl.internalReleasePageContext(JspFactoryImpl.java: 198) at org.apache.jasper.runtime.JspFactoryImpl.releasePageContext(JspFactoryImpl.java:193) at org.apache.jsp.ViewAttachment_jsp._jspService(ViewAttachment_jsp.java: 76) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:137) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java: 210) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java: 684) at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:432) at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java: 356) We intend to migrate to Tomcat 5.x later this year. In the interim, we recently linked this exception event to leaked memory. That is, the PageContextImpl.release() method (6th from top in stack trace, body below) never completes as it does not catch the IllegalStateException that happens when ResponseBase.getWriter()is called in the scope of flushBuffer(). public void release() { out = baseOut; try { if (isIncluded) { ((JspWriterImpl)out).flushBuffer(); // push it into the including jspWriter } else { // Do not flush the buffer even if we're not included (i.e. // we are the main page. The servlet will flush it and close // the stream. ((JspWriterImpl)out).flushBuffer(); } } catch (IOException ex) { loghelper.log(Internal error flushing the buffer in release()); } servlet = null; config = null; context = null; needsSession = false; errorPageURL = null; bufferSize = JspWriter.DEFAULT_BUFFER; autoFlush= true; request = null; response = null; depth = -1; baseOut.recycle(); session = null; attributes.clear(); } The tear-down activity session=null is skipped because of the exception, which creates a problem since the session so referenced becomes ineligible for garbage collection after processing the request.Does anyone know: a) is this documented somewhere (I read 102 matches for memory
Re: Is there Patch for 4.1 PageContextImpl unhandled IllegalStateException?
Matthew, I take it that you call response.getOutputStream() within your JSP? If so, this is a spec violation (section JSP.2.7 of JSP 1.2): spec-quote JSP page authors are prohibited from writing directly to either the PrintWriter or OutputStream associated with the ServletResponse. /spec-quote If you are using response.getOutputStream() in your JSP then you will need to write a servlet. If the memory leak only occurs when the spec is violated (as I think is the case from what you have said) then it is going to be right at the bottom of the to-do list and is unlikely to be addressed. However, if my assumption about your call to response.getOutputStream() is wrong, then this is a bug and it should get fixed pretty quickly - how soon there is another 4.1.x release is another question ;) What would be a big help in this case is the smallest JSP you can construct that demonstrates the bug. Mark [EMAIL PROTECTED] wrote: Hi Mark, Thanks for your quick response. The string 'getOutputStream' actually is retrieved from org/apache/catalina/connector/LocalStrings.properties using key 'responseBase.getWriter.ise' by org.apache.catalina.ResponseBase.getWriter(). getOutputStream() is called from org.apache.jasper.runtime.JspWriterImpl.initOut() which is called from same class flushBuffer() method. flushBuffer() is in turn called by PageContextImpl.release() which is method I included in my previous email. The ViewAttachment.jsp (8th line down in the prev. stack trace) is the where the problem originates. This JSP writes to output stream the file attachment, but since the JSP already has an output stream active, this causes the exception (I think.) I could rewrite the application as a servet, as a fix. However, before doing that I wanted to find out if the memory leak is: a) a known limitation b) whether a patch is available for example to add a finally block to PageContextImpl. release() which would solve the leak problem. Thanks, Matthew Original Message From: [EMAIL PROTECTED] Date: May 30, 2005 9:07:35 PM To: Tomcat Users List tomcat-user@jakarta.apache.org Subj: Re: Is there Patch for 4.1 PageContextImpl unhandled IllegalStateException? Hmm. Looks like PageContextImpl.release() code could do with a clean up ;) Ignoring that for now, do you have any idea what is calling getOutputStream()? Is it called in ViewAttachment.jsp? Mark [EMAIL PROTECTED] wrote: Hello Tomcat Users and Committers,Platform: Tomcat 4.1, Linux ES 2.1, jdk1.4.1.06 Here is a snippet of the stack trace we regularly in our Tomcat 4.1.24 logs. - Root Cause - java.lang.IllegalStateException: getOutputStream() has already been called for this response at org.apache.catalina.connector.ResponseBase.getWriter(ResponseBase.java: 756) at org.apache.catalina.connector.ResponseFacade.getWriter(ResponseFacade.java:174) at org.apache.jasper.runtime.JspWriterImpl.initOut(JspWriterImpl.java:173) at org.apache.jasper.runtime.JspWriterImpl.flushBuffer(JspWriterImpl.java: 166) at org.apache.jasper.runtime.PageContextImpl.release(PageContextImpl.java:184) at org.apache.jasper.runtime.JspFactoryImpl.internalReleasePageContext(JspFactoryImpl.java: 198) at org.apache.jasper.runtime.JspFactoryImpl.releasePageContext(JspFactoryImpl.java:193) at org.apache.jsp.ViewAttachment_jsp._jspService(ViewAttachment_jsp.java: 76) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:137) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java: 210) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java: 684) at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:432) at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java: 356) We intend to migrate to Tomcat 5.x later this year. In the interim, we recently linked this exception event to leaked memory. That is, the PageContextImpl.release() method (6th from top in stack trace, body below) never completes as it does not catch the IllegalStateException that happens when ResponseBase.getWriter()is called in the scope of flushBuffer(). public void release() { out = baseOut; try { if (isIncluded) { ((JspWriterImpl)out).flushBuffer(); // push it into the including jspWriter } else { // Do not flush the buffer even if we're not included (i.e. // we are the main page. The servlet will flush
response.sendredirect and IllegalStateException
Hi, I was using tomcat 3.1 for one of my client sites. Currently they gonna update it to the latest. When I ported by the application into tomcat 5.5, I found that response.SendRedirect is giving me the error which was due to the calling the some action after calling the SendRedirect. But since it's working in 3.1, do we've any setting in 5.5 which can bypass this check ? Otherwise I'll have to rewrite all my jsp pages. Regards Abhi
Re: IllegalStateException: getOutputStream() has already been called for this response
Thanks for the advice Roberto. I agree that the approach is wrong, but in my real application I definitely use the MVC pattern as much as possible. The problem I'm running into is that my servlet calls other classes to do the business logic. One of these classes does XSLT. What I end up doing is getting the OutputStream from the servlet and passing it down to the class that does the transformation, which sends the results of the transformation to this OutputStream. Exceptions could possible occur during the transformation, and this is where I run into this problem of the jsp error page not getting called. The use of OutputStream or Writer for the XSLT results is what keeps me from doing exactly what you suggested. I have this one hook, so to speak. I welcome any suggestions/work-arounds other than what I'm doing now with the use of the OutputStream in the XSLT transformation. Thanks. Roberto Cosenza [EMAIL PROTECTED] 02/08/2005 04:46 PM Please respond to Tomcat Users List tomcat-user@jakarta.apache.org To Tomcat Users List tomcat-user@jakarta.apache.org cc Subject Re: IllegalStateException: getOutputStream() has already been called for this response Your approach is bad but don't worry. If you have time, read something about MVC. You will need it eventually. To make your servlet work, try something like: public void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { StringBuffer myOutput = new StringBuffer(); try { myOutput.append(Here I'm not doing anything illegal); if(true) throw new BookNotFoundException(Book doesn't exist); } catch (Exception e) { System.out.println(Caught exception: + e.getMessage()); throw new ServletException(Dummy Exception, e); } // you reach this only if no errors have been caught so no error page to display OutputStream out = res.getOutputStream(); res.setContentType(text/plain); out.println(myOutput.toString()); } /roberto - Original Message - From: DAVID TURNER To: tomcat-user@jakarta.apache.org Sent: Tuesday, February 08, 2005 9:56 PM Subject: IllegalStateException: getOutputStream() has already been called for this response I'm trying to write a servlet that handles business logic exceptions by specifying in the web.xml the jsp error page that I want to use for a specific Exception (see web.xml snippet below). I have this working when I use response.getWriter() in the servlet instead of response.getOutputStream() -- see sample servlet code below. But, when I try to use the response.getOutputStream() approach the jsp error page doesn't work and an IllegalStateException: getOutputStream() has already been called for this response gets thrown because the jsp is probably trying to get the OutputStream also. Why does the response.getWriter() method work even after headers/data have been written to the writer? Is there any way to get the jsp error page to work with the getOutputStream()? I would like to eventually compress the response stream, but from all the examples I've come across on compression they all use getOutputStream. web.xml contents: error-page exception-typeBookNotFoundException/exception-type location/jsp/ErrorPage.jsp/location /error-page servlet contents: public void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { PrintWriter out = res.getWriter(); //OutputStream out = res.getOutputStream(); res.setContentType(text/plain); try { out.println(Line 1 of servlet); //out.write(Line 1 of servlet.getBytes()); throw new BookNotFoundException(Book doesn't exist); } catch (Exception e) { res.reset(); System.out.println(Caught exception: + e.getMessage()); throw new ServletException(Dummy Exception, e); } } -- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: IllegalStateException: getOutputStream() has already been called for this response
Just don't pass the ouput stream that you get from the servlet but create a new one. When you are done with your business, you'll copy the one on the other. On Wed, 9 Feb 2005 08:24:05 -0500, DAVID TURNER [EMAIL PROTECTED] wrote: Thanks for the advice Roberto. I agree that the approach is wrong, but in my real application I definitely use the MVC pattern as much as possible. The problem I'm running into is that my servlet calls other classes to do the business logic. One of these classes does XSLT. What I end up doing is getting the OutputStream from the servlet and passing it down to the class that does the transformation, which sends the results of the transformation to this OutputStream. Exceptions could possible occur during the transformation, and this is where I run into this problem of the jsp error page not getting called. The use of OutputStream or Writer for the XSLT results is what keeps me from doing exactly what you suggested. I have this one hook, so to speak. -- Roberto Cosenza http://robcos.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
IllegalStateException: getOutputStream() has already been called for this response
I'm trying to write a servlet that handles business logic exceptions by specifying in the web.xml the jsp error page that I want to use for a specific Exception (see web.xml snippet below). I have this working when I use response.getWriter() in the servlet instead of response.getOutputStream() -- see sample servlet code below. But, when I try to use the response.getOutputStream() approach the jsp error page doesn't work and an IllegalStateException: getOutputStream() has already been called for this response gets thrown because the jsp is probably trying to get the OutputStream also. Why does the response.getWriter() method work even after headers/data have been written to the writer? Is there any way to get the jsp error page to work with the getOutputStream()? I would like to eventually compress the response stream, but from all the examples I've come across on compression they all use getOutputStream. web.xml contents: error-page exception-typeBookNotFoundException/exception-type location/jsp/ErrorPage.jsp/location /error-page servlet contents: public void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { PrintWriter out = res.getWriter(); //OutputStream out = res.getOutputStream(); res.setContentType(text/plain); try { out.println(Line 1 of servlet); //out.write(Line 1 of servlet.getBytes()); throw new BookNotFoundException(Book doesn't exist); } catch (Exception e) { res.reset(); System.out.println(Caught exception: + e.getMessage()); throw new ServletException(Dummy Exception, e); } }- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: IllegalStateException: getOutputStream() has already been called for this response
Your approach is bad but don't worry. If you have time, read something about MVC. You will need it eventually. To make your servlet work, try something like: public void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { StringBuffer myOutput = new StringBuffer(); try { myOutput.append(Here I'm not doing anything illegal); if(true) throw new BookNotFoundException(Book doesn't exist); } catch (Exception e) { System.out.println(Caught exception: + e.getMessage()); throw new ServletException(Dummy Exception, e); } // you reach this only if no errors have been caught so no error page to display OutputStream out = res.getOutputStream(); res.setContentType(text/plain); out.println(myOutput.toString()); } /roberto - Original Message - From: DAVID TURNER To: tomcat-user@jakarta.apache.org Sent: Tuesday, February 08, 2005 9:56 PM Subject: IllegalStateException: getOutputStream() has already been called for this response I'm trying to write a servlet that handles business logic exceptions by specifying in the web.xml the jsp error page that I want to use for a specific Exception (see web.xml snippet below). I have this working when I use response.getWriter() in the servlet instead of response.getOutputStream() -- see sample servlet code below. But, when I try to use the response.getOutputStream() approach the jsp error page doesn't work and an IllegalStateException: getOutputStream() has already been called for this response gets thrown because the jsp is probably trying to get the OutputStream also. Why does the response.getWriter() method work even after headers/data have been written to the writer? Is there any way to get the jsp error page to work with the getOutputStream()? I would like to eventually compress the response stream, but from all the examples I've come across on compression they all use getOutputStream. web.xml contents: error-page exception-typeBookNotFoundException/exception-type location/jsp/ErrorPage.jsp/location /error-page servlet contents: public void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { PrintWriter out = res.getWriter(); //OutputStream out = res.getOutputStream(); res.setContentType(text/plain); try { out.println(Line 1 of servlet); //out.write(Line 1 of servlet.getBytes()); throw new BookNotFoundException(Book doesn't exist); } catch (Exception e) { res.reset(); System.out.println(Caught exception: + e.getMessage()); throw new ServletException(Dummy Exception, e); } } -- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
IllegalStateException from java.nio.charset.CharsetEncoder
On one of our servers, we're using Tomcat 4.1.29 under Java 1.4.2_02, connecting to Apache 2.0.48 with mod_jk 1.2.4, all running on Red Hat Linux 6.2. (Wow, what a zoo of version numbers!) Recently we got a support call because some (all?) HTTP requests were failing with Internal Server Error. The support tech who took the call noticed this in mod_jk's log file: [Sat Aug 28 15:59:39 2004] [jk_ajp_common.c (1309)]: sending request to tomcat failed in send loop. err=2 [Sat Aug 28 15:59:39 2004] [jk_ajp_common.c (1318)]: Error connecting to tomcat. Tomcat is probably not started or is listening on the wrong port. Failed errno = 104 (Errno 104, for the curious, is ECONNRESET -- Connection reset by peer.) He tried restarting Tomcat, which sounds like the right thing to me. That didn't help, so then he tried restarting Apache. Still nothing, so he rebooted the server, after which things started working again. H. Looking in catalina.out after the reboot, I saw this stack trace: java.lang.IllegalStateException: Current state = FLUSHED, new state = CODING_END at java.nio.charset.CharsetEncoder.throwIllegalStateException(CharsetEncoder.java:933) at java.nio.charset.CharsetEncoder.encode(CharsetEncoder.java:529) at sun.nio.cs.StreamEncoder$CharsetSE.flushLeftoverChar(StreamEncoder.java:358) at sun.nio.cs.StreamEncoder$CharsetSE.implClose(StreamEncoder.java:414) at sun.nio.cs.StreamEncoder.close(StreamEncoder.java:160) at java.io.OutputStreamWriter.close(OutputStreamWriter.java:222) at java.io.PrintWriter.close(PrintWriter.java:137) at org.apache.catalina.connector.ResponseBase.finishResponse(ResponseBase.java:483) at org.apache.catalina.connector.HttpResponseBase.finishResponse(HttpResponseBase.java:253) at org.apache.ajp.tomcat4.Ajp13Response.finishResponse(Ajp13Response.java:191) at org.apache.ajp.tomcat4.Ajp13Processor.process(Ajp13Processor.java:479) at org.apache.ajp.tomcat4.Ajp13Processor.run(Ajp13Processor.java:576) at java.lang.Thread.run(Thread.java:534) Of course, catalina.out is clobbered with every Tomcat restart, so there's no way of knowing if this exception is actually the cause of the problem, i.e. if it was happening before the first Tomcat restart. Nevertheless, I poked around a bit and stumbled across these two entries in Tomcat's bug database: http://nagoya.apache.org/bugzilla/show_bug.cgi?id=7725 http://nagoya.apache.org/bugzilla/show_bug.cgi?id=6519 Both of these have a *nearly* identical stack trace (the connector is different -- org.apache.catalina.connector.http.HttpProcessor vs org.apache.ajp.tomcat4.Ajp13Processor in my example) that ends with the same IllegalStateException. Both are about 2 years old, around the time that Tomcat 4.0 and Java 1.4 were in beta. And it sorta-kinda-vaguely sounded like the bug(s), whatever they were, have been fixed. First of all, from those two bug reports, it's not clear if this is a Tomcat bug or a Java bug. Second of all, has anyone else seen this on stable, mature versions of Tomcat 4.0 and Java 1.4 (ie. 4.0.29 and 1.4.2_02)? Thanks -- Greg - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
IllegalStateException thrown in core code...
I have a commercial servlet that throws an exception. I have an error-page directive setup to send that page to my ErrorLogServlet. However, my error servlet never gets called as Tomcat throws the IllegalStateException below. Any ideas on what the cause might be? I'm running Tomcat-5.0.24 with the hotfix that was released shortly thereafter. Note that I removed (org.apache.) from the traceback to make it more readable in e-mail. [EMAIL PROTECTED]: Exception Processing ErrorPage[exceptionType=javax.servlet.ServletException, location=/exception.err] java.lang.IllegalStateException at coyote.Response.reset(Response.java:296) at coyote.tomcat5.CoyoteResponse.reset(CoyoteResponse.java:631) at coyote.tomcat5.CoyoteResponse.reset(CoyoteResponse.java:887) at catalina.core.StandardHostValve.custom(StandardHostValve.java:389) at catalina.core.StandardHostValve.throwable(StandardHostValve.java:225) at catalina.core.StandardHostValve.invoke(StandardHostValve.java:145) at catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104) at catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117) at catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102) at catalina.core.StandardPipeline.invoke(StandardPipeline.java:520) at catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104) at catalina.core.StandardPipeline.invoke(StandardPipeline.java:520) at catalina.core.ContainerBase.invoke(ContainerBase.java:929) at coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160) at jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:296) at jk.common.HandlerRequest.invoke(HandlerRequest.java:372) at jk.common.ChannelSocket.invoke(ChannelSocket.java:694) at jk.common.ChannelSocket.processConnection(ChannelSocket.java:626) at jk.common.SocketConnection.runIt(ChannelSocket.java:807) at tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:644) at java.lang.Thread.run(Thread.java:534) Thanks for the pointers. --Kaleb - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: IllegalStateException
On Wed, Jul 07, 2004 at 10:28:25PM +0200, Dr. Franz X. Steinparz wrote: ^^ Hello I urgently need help. Could you please set the date correctly on your computer, Herr Dr. Steinparz -- Chris Christoph P. U. Kukulies kuku_at_physik.rwth-aachen.de - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
IllegalStateException
Hello I urgently need help. I have a problem deploying an application developped under Oracles JDeveloper to Tomcat. The application consists of several servlets, passing over request and esponse objects from one servlet to another. The application works fine within Oracles IDE and it's built in servlet runner. However after deploying the app to Tomcat, Tomcat raises an IllegalStateException (java.lang.IllegalStateException org.apache.coyote.tomcat5.CoyoteResponseFacade.sendRedirect(CoyoteResponseFacade.java:399) ... when a reponse object is handed over to another servlet. thank you franz steinparz - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: IllegalStateException
On Wed, Jul 07, 2004 at 10:28:25PM +0200, Dr. Franz X. Steinparz wrote: : The application works fine within Oracles IDE and it's built in servlet : runner. However after deploying the app to Tomcat, Tomcat raises an : IllegalStateException : (java.lang.IllegalStateException : org.apache.coyote.tomcat5.CoyoteResponseFacade.sendRedirect(CoyoteResponseFacade.java:399) : ... : when a reponse object is handed over to another servlet. Perhaps: http://www.jguru.com/faq/view.jsp?EID=501393 Otherwise: Full stack trace, please? -QM -- software -- http://www.brandxdev.net tech news -- http://www.RoarNetworX.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: IllegalStateException
Check the javadoc for HttpServletResponse.sendRedirect(String), an interface that CoyoteResponseFacade implements. Did your servlet commit a response, or have a bad URL? If you've written output before the sendRedirect, you may have filled the output buffer, thereby committing it. Layton Berry -Original Message- From: Dr. Franz X. Steinparz [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 07, 2004 12:28 PM To: Tomcat Users List Subject: IllegalStateException Hello I urgently need help. I have a problem deploying an application developped under Oracles JDeveloper to Tomcat. The application consists of several servlets, passing over request and esponse objects from one servlet to another. The application works fine within Oracles IDE and it's built in servlet runner. However after deploying the app to Tomcat, Tomcat raises an IllegalStateException (java.lang.IllegalStateException org.apache.coyote.tomcat5.CoyoteResponseFacade.sendRedirect(Coy oteResponseFacade.java:399) ... when a reponse object is handed over to another servlet. thank you franz steinparz - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: IllegalStateException
Once you perform a sendRedirect or the response is committed, it is illegal to call sendRedirect again. (I am guessing sendRedirect is being called twice in the life of the request) -Tim Dr. Franz X. Steinparz wrote: Hello I urgently need help. I have a problem deploying an application developped under Oracles JDeveloper to Tomcat. The application consists of several servlets, passing over request and esponse objects from one servlet to another. The application works fine within Oracles IDE and it's built in servlet runner. However after deploying the app to Tomcat, Tomcat raises an IllegalStateException (java.lang.IllegalStateException org.apache.coyote.tomcat5.CoyoteResponseFacade.sendRedirect(CoyoteResponseFacade.java:399) ... when a reponse object is handed over to another servlet. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
SendRedirect and IllegalStateException
Hi Everyone, I am brushing up on my servlet programming after a long lay off. I was working through this book and came across the perils of using sendRedirect after commiting the response. My understanding according to the book and the 2.4 servlet api is that if you call the sendRedirect method after outputting something with the PrintWriter and flushing it should throw an Illegal exception, right? I want to know if anyone out there also noticed this or am I doing something wrong? Tomcat version: 5.0.19 OS: Mac OS X 10.3.3 J2SDK: 1.4.2_03 My code: import java.io.*; import javax.servlet.*; import javax.servlet.http.*; public class RedirectException extends HttpServlet{ public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { PrintWriter writer = response.getWriter(); writer.println(HTML); writer.println(BODY); writer.println(Company News!!); writer.println(/BODY); writer.println(/HTML); writer.flush(); response.sendRedirect(http://news.bbc.co.uk;); } } What is happening is that the browser is displaying Company News! Thanks, Umesh - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: SendRedirect and IllegalStateException
It should display company news. And you should see in your logs an IllegalStateException. (And the stack trace should contain the sendRedirect method) -Tim Umesha Balasubramaniam wrote: Hi Everyone, I am brushing up on my servlet programming after a long lay off. I was working through this book and came across the perils of using sendRedirect after commiting the response. My understanding according to the book and the 2.4 servlet api is that if you call the sendRedirect method after outputting something with the PrintWriter and flushing it should throw an Illegal exception, right? I want to know if anyone out there also noticed this or am I doing something wrong? Tomcat version: 5.0.19 OS: Mac OS X 10.3.3 J2SDK: 1.4.2_03 My code: import java.io.*; import javax.servlet.*; import javax.servlet.http.*; public class RedirectException extends HttpServlet{ public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { PrintWriter writer = response.getWriter(); writer.println(HTML); writer.println(BODY); writer.println(Company News!!); writer.println(/BODY); writer.println(/HTML); writer.flush(); response.sendRedirect(http://news.bbc.co.uk;); } } What is happening is that the browser is displaying Company News! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Sudden IllegalStateException
Howdy, How does a RequestDispatcher forward behave here (as opposed to a sendRedirect)? Also, make sure you call encodeRedirectUrl before redirecting (though this wouldn't cause an IllegalState problem, it's a good idea). Yoav Shapira Millennium ChemInformatics -Original Message- From: Merrill Cornish [mailto:[EMAIL PROTECTED] Sent: Wednesday, December 31, 2003 4:54 PM To: Tomcat Users List Subject: Sudden IllegalStateException I have been developing a JSP/servlet application using Tomcat 5.0.16. Over the past months, I felt that I had learned enough (partially with the help of this mailing list) about JSP, servlets, and Tomcat that I could debug most of the obsticales that popped up. Until this morning. I started addnig a new servlet several levels down. Suddenly, I started getting the following error: java.lang.IllegalStateException org.apache.coyote.tomcat5.CoyoteResponseFacade.sendRedirect(CoyoteRes ponseFacade.java:379) Timesheet.LoginServlet.doPost(LoginServlet.java:67) javax.servlet.http.HttpServlet.service(HttpServlet.java:763) javax.servlet.http.HttpServlet.service(HttpServlet.java:856) When I launch the application, the Tomcat HTML welcome page redirects via a refresh to my login.jsp page via https. That login page displays properly. When I fill in the login name and password and click on submit, I immediately get the above exception. The line number it references is the following: response.sendRedirect(Util.MAIN_MENU_PAGE_URL); where Util.MAIN_MENU_PAGE_URL is /timesheet/mainMenu.jsp, a valid page URL. This sendRedirect() is the last thing the login servlet does after validating the login and collecting information about the logged in user from the database. This has all been working for months. The one time I got an illegal state exception before was when I accidently did something like session.getAttribute() when the session was invalid. However, the login servlet starts with HttpSession session = request.getSession(true); which is the ONLY time it's called with a true argument. I have also verified that immediately before the call to sendRedirect(), both the session and response variables have reasonable values. Can any one suggest what I may have changed to suddenly get an illegal state exception? Merrill Cornish - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Sudden IllegalStateException
On Wednesday 31 December 2003 09:00 pm, Merrill Cornish wrote: Ben, I don't know if it's a good idea or not, but I separate the HTML stuff into the JSP pages and use the servlets solely for program logic. It is a good idea. The MVC pattern is widely accepted as a best practice for server side java. Therefore, my servlets never output content.. Instead they merely redirect to a JSP page which then contains only enough Java logic to collect the data it needs from session attributes. Are you able to post your servlet/JSP code? If not on the list, you can send it to me personally. I've been working on a fairly large app that uses the request dispatcher extensivly without running into this problem. I'd be interested to see what your program is doing. Merrill - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Ben Souther F.W. Davison Company, Inc. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Sudden IllegalStateException
Ben, Yes, I can post the code, but now I'm not sure that will help. Yesterday I tried my old standby debugging technique of commenting out virtually all of the code in the servlet. It worked. I then started uncommenting portions until it stopped working. For a while, I thought I was winning. I got it down to where if a call to one subroutine was commented out, it worked; but if the subroutine was called, the return would fail when it reached the sendRedirect() back in the servlet. Then I noticed that SOMETIMES a call to the subroutine would not fail. [sigh...] The subroutine in question does database access with no sendRedirect() or any other funny business. Right now, I'm trying to further characterize the problem. I may still take you up on your offer of help (and thank you, by the way), but I need to do some work first. Thanks, Merrill - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Sudden IllegalStateException
Hello Merrill If you're still working on this tomorrow and you want to share your code I'd be willing to walk it through. Howard Watson Database Administrator Easter Seals-Goodwill Northern Rocky Mountain 4400 Central Avenue Great Falls, Montana 59405 (406) 771-3759 [EMAIL PROTECTED] [EMAIL PROTECTED] 12/31/03 14:59 PM I have been developing a JSP/servlet application using Tomcat 5.0.16. Over the past months, I felt that I had learned enough (partially with the help of this mailing list) about JSP, servlets, and Tomcat that I could debug most of the obsticales that popped up. Until this morning. I started addnig a new servlet several levels down. Suddenly, I started getting the following error: java.lang.IllegalStateException org.apache.coyote.tomcat5.CoyoteResponseFacade.sendRedirect(CoyoteResponseFacade.java:379) Timesheet.LoginServlet.doPost(LoginServlet.java:67) javax.servlet.http.HttpServlet.service(HttpServlet.java:763) javax.servlet.http.HttpServlet.service(HttpServlet.java:856) When I launch the application, the Tomcat HTML welcome page redirects via a refresh to my login.jsp page via https. That login page displays properly. When I fill in the login name and password and click on submit, I immediately get the above exception. The line number it references is the following: response.sendRedirect(Util.MAIN_MENU_PAGE_URL); where Util.MAIN_MENU_PAGE_URL is /timesheet/mainMenu.jsp, a valid page URL. This sendRedirect() is the last thing the login servlet does after validating the login and collecting information about the logged in user from the database. This has all been working for months. The one time I got an illegal state exception before was when I accidently did something like session.getAttribute() when the session was invalid. However, the login servlet starts with HttpSession session = request.getSession(true); which is the ONLY time it's called with a true argument. I have also verified that immediately before the call to sendRedirect(), both the session and response variables have reasonable values. Can any one suggest what I may have changed to suddenly get an illegal state exception? Merrill Cornish - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Sudden IllegalStateException
I have been developing a JSP/servlet application using Tomcat 5.0.16. Over the past months, I felt that I had learned enough (partially with the help of this mailing list) about JSP, servlets, and Tomcat that I could debug most of the obsticales that popped up. Until this morning. I started addnig a new servlet several levels down. Suddenly, I started getting the following error: java.lang.IllegalStateException org.apache.coyote.tomcat5.CoyoteResponseFacade.sendRedirect(CoyoteResponseFacade.java:379) Timesheet.LoginServlet.doPost(LoginServlet.java:67) javax.servlet.http.HttpServlet.service(HttpServlet.java:763) javax.servlet.http.HttpServlet.service(HttpServlet.java:856) When I launch the application, the Tomcat HTML welcome page redirects via a refresh to my login.jsp page via https. That login page displays properly. When I fill in the login name and password and click on submit, I immediately get the above exception. The line number it references is the following: response.sendRedirect(Util.MAIN_MENU_PAGE_URL); where Util.MAIN_MENU_PAGE_URL is /timesheet/mainMenu.jsp, a valid page URL. This sendRedirect() is the last thing the login servlet does after validating the login and collecting information about the logged in user from the database. This has all been working for months. The one time I got an illegal state exception before was when I accidently did something like session.getAttribute() when the session was invalid. However, the login servlet starts with HttpSession session = request.getSession(true); which is the ONLY time it's called with a true argument. I have also verified that immediately before the call to sendRedirect(), both the session and response variables have reasonable values. Can any one suggest what I may have changed to suddenly get an illegal state exception? Merrill Cornish - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Sudden IllegalStateException
From here: http://jakarta.apache.org/tomcat/faq/misc.html#illegalstate Why do I get java.lang.IllegalStateException? These are the most common reasons how you can get an java.lang.IllegalStateException: Calling setBufferSize and content has been written. The response has been committed and you do any of the following: Calling ServletResponse.reset() or ServletResponse.resetBuffer() Calling either HttpServletResponse.sendError() or HttpServletResponse.sendRedirect(). Calling RequestDispatcher.forward() which includes performing a jsp:forward Calling RequestDispatcher.forward() which includes performing a jsp:forward I did it the other day like this: added this line to an existing page - not thinking forced the session to null for testing if (session null) {send.redirect sessionTimeoutPage} this code already existed some more code sendRedirect to next valid page added in else and fixed it [EMAIL PROTECTED] 12/31/03 02:54PM I have been developing a JSP/servlet application using Tomcat 5.0.16. Over the past months, I felt that I had learned enough (partially with the help of this mailing list) about JSP, servlets, and Tomcat that I could debug most of the obsticales that popped up. Until this morning. I started addnig a new servlet several levels down. Suddenly, I started getting the following error: java.lang.IllegalStateException org.apache.coyote.tomcat5.CoyoteResponseFacade.sendRedirect(CoyoteResponseFacade.java:379) Timesheet.LoginServlet.doPost(LoginServlet.java:67) javax.servlet.http.HttpServlet.service(HttpServlet.java:763) javax.servlet.http.HttpServlet.service(HttpServlet.java:856) When I launch the application, the Tomcat HTML welcome page redirects via a refresh to my login.jsp page via https. That login page displays properly. When I fill in the login name and password and click on submit, I immediately get the above exception. The line number it references is the following: response.sendRedirect(Util.MAIN_MENU_PAGE_URL); where Util.MAIN_MENU_PAGE_URL is /timesheet/mainMenu.jsp, a valid page URL. This sendRedirect() is the last thing the login servlet does after validating the login and collecting information about the logged in user from the database. This has all been working for months. The one time I got an illegal state exception before was when I accidently did something like session.getAttribute() when the session was invalid. However, the login servlet starts with HttpSession session = request.getSession(true); which is the ONLY time it's called with a true argument. I have also verified that immediately before the call to sendRedirect(), both the session and response variables have reasonable values. Can any one suggest what I may have changed to suddenly get an illegal state exception? Merrill Cornish - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Sudden IllegalStateException
Howard, I had already read the misc.html#illegalstate. In my case, I KNOW the illegal state was triggered by sendRedirect() since that's what's in the trace back. Also, I've already verified that immediately before the call to sendRedirect(), both session and response are OK. I forgot to mention in the first post that I've already tried stopping and starting Tomcat, stopping and relaunching the browser, and recompiling all servlets. My question is WHY is sendRedirect() causing the problem. Merrill - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Sudden IllegalStateException
Are you real sure that you do not have more than one sendRedirect in your code that can be processed sequentially? The first one will set a header and the second will throw an error. Have a Happy New Year! [EMAIL PROTECTED] 12/31/03 03:43PM Howard, I had already read the misc.html#illegalstate. In my case, I KNOW the illegal state was triggered by sendRedirect() since that's what's in the trace back. Also, I've already verified that immediately before the call to sendRedirect(), both session and response are OK. I forgot to mention in the first post that I've already tried stopping and starting Tomcat, stopping and relaunching the browser, and recompiling all servlets. My question is WHY is sendRedirect() causing the problem. Merrill - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Sudden IllegalStateException
Howard, There are three sendRedirect() calls in the servlet. The first two redirect back to the login page if with the login user id is not found or the login password doesn't match. In both cases, the sendRedirect() is immediately followed by a return. (I learned to use explicit returns after sendRedirect() some time ago.) The sendRedirect() that is throwing the error is the last statement in the overall try{} block. There is a catch for SQLException which calls a function that would call sendRedirect() to get to the error page, but if we've gotten to the last statement in the try{} block, there was no SQLException. The only thing after the try{}/catch{} is again a return. Merrill - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Sudden IllegalStateException
I'd be more concerned with what is before it. If anything writes to either the page or the headers before a redirect, it will throw an IllegalStateException. Did you set a content type? On Wednesday 31 December 2003 06:34 pm, you wrote: Howard, There are three sendRedirect() calls in the servlet. The first two redirect back to the login page if with the login user id is not found or the login password doesn't match. In both cases, the sendRedirect() is immediately followed by a return. (I learned to use explicit returns after sendRedirect() some time ago.) The sendRedirect() that is throwing the error is the last statement in the overall try{} block. There is a catch for SQLException which calls a function that would call sendRedirect() to get to the error page, but if we've gotten to the last statement in the try{} block, there was no SQLException. The only thing after the try{}/catch{} is again a return. Merrill - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Sudden IllegalStateException
May be I'm trying to help with something over my head. When I had this error I read about using Return and could not visualize where from a servlet I would return to in a JSP., so I know I need to research this. However, the point is from the faq link I gave you: These are the most common reasons how you can get an java.lang.IllegalStateException: The response has been committed and you do any of the following which I believe is same thing bpsouther is saying. If for instance you execute sendRedirect and a doPost begins to execute (this was my case) and encounters another sendRedirect you will get an error because the previous sendRedirect has already set the header. The key thing is that somewhere in your nested code a response has begun before the sendRedirect that is throwing an error. Since at this point I can't visualize a single Return I probably can't help you with a nested Return. [EMAIL PROTECTED] 12/31/03 16:40 PM Howard, There are three sendRedirect() calls in the servlet. The first two redirect back to the login page if with the login user id is not found or the login password doesn't match. In both cases, the sendRedirect() is immediately followed by a return. (I learned to use explicit returns after sendRedirect() some time ago.) The sendRedirect() that is throwing the error is the last statement in the overall try{} block. There is a catch for SQLException which calls a function that would call sendRedirect() to get to the error page, but if we've gotten to the last statement in the try{} block, there was no SQLException. The only thing after the try{}/catch{} is again a return. Merrill - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Sudden IllegalStateException
Ben, I don't know if it's a good idea or not, but I separate the HTML stuff into the JSP pages and use the servlets solely for program logic. Therefore, my servlets never output content.. Instead they merely redirect to a JSP page which then contains only enough Java logic to collect the data it needs from session attributes. Merrill - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
IllegalStateException in catalina.out
Hello! I am using: TC4.1.24, jdk1.4.1, Apache , ajp13 connector, on Unix SunOS 5.8. I sometimes get following errors in the catalina.out: java.lang.IllegalStateException: Current state = FLUSHED, new state = CODING_END at java.nio.charset.CharsetEncoder.throwIllegalStateException(CharsetEncoder.java:933) at java.nio.charset.CharsetEncoder.encode(CharsetEncoder.java:529) at sun.nio.cs.StreamEncoder$CharsetSE.flushLeftoverChar(StreamEncoder.java:356) at sun.nio.cs.StreamEncoder$CharsetSE.implClose(StreamEncoder.java:412) at sun.nio.cs.StreamEncoder.close(StreamEncoder.java:158) at java.io.OutputStreamWriter.close(OutputStreamWriter.java:222) at java.io.PrintWriter.close(PrintWriter.java:137) at org.apache.catalina.connector.ResponseBase.finishResponse(ResponseBase.java:483) at org.apache.catalina.connector.HttpResponseBase.finishResponse(HttpResponseBase.java:253) at org.apache.ajp.tomcat4.Ajp13Response.finishResponse(Ajp13Response.java:191) at org.apache.ajp.tomcat4.Ajp13Processor.process(Ajp13Processor.java:488) at org.apache.ajp.tomcat4.Ajp13Processor.run(Ajp13Processor.java:585) at java.lang.Thread.run(Thread.java:536) If I run my programms under WIN2000 and the same configurations as above, I don't get this erros. Does anyone has an answer? Michael Sonnleitner - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: IllegalStateException in catalina.out
http://jakarta.apache.org/tomcat/faq/misc.html#illegalstate -Tim [EMAIL PROTECTED] wrote: Hello! I am using: TC4.1.24, jdk1.4.1, Apache , ajp13 connector, on Unix SunOS 5.8. I sometimes get following errors in the catalina.out: java.lang.IllegalStateException: Current state = FLUSHED, new state = CODING_END at java.nio.charset.CharsetEncoder.throwIllegalStateException(CharsetEncoder.java:933) at java.nio.charset.CharsetEncoder.encode(CharsetEncoder.java:529) at sun.nio.cs.StreamEncoder$CharsetSE.flushLeftoverChar(StreamEncoder.java:356) at sun.nio.cs.StreamEncoder$CharsetSE.implClose(StreamEncoder.java:412) at sun.nio.cs.StreamEncoder.close(StreamEncoder.java:158) at java.io.OutputStreamWriter.close(OutputStreamWriter.java:222) at java.io.PrintWriter.close(PrintWriter.java:137) at org.apache.catalina.connector.ResponseBase.finishResponse(ResponseBase.java:483) at org.apache.catalina.connector.HttpResponseBase.finishResponse(HttpResponseBase.java:253) at org.apache.ajp.tomcat4.Ajp13Response.finishResponse(Ajp13Response.java:191) at org.apache.ajp.tomcat4.Ajp13Processor.process(Ajp13Processor.java:488) at org.apache.ajp.tomcat4.Ajp13Processor.run(Ajp13Processor.java:585) at java.lang.Thread.run(Thread.java:536) If I run my programms under WIN2000 and the same configurations as above, I don't get this erros. Does anyone has an answer? Michael Sonnleitner - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: IllegalStateException - org.apache.coyote.tomcat4.CoyoteRequest.doGetSession()
Thanks guys! I went through the code last night, after sending the e-mail. I think I found the problem. Our developer uses dynamically included JSP declaring session=true (by not declaring anything) while the parent declares session=false. We'll go through a set of tests anyway. I'm ashamed to doubt about Tomcat now ;-). Take care all! - Yagiz Erkan - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
IllegalStateException - org.apache.coyote.tomcat4.CoyoteRequest.doGetSession()
Hi all, We're running Tomcat 4.1.24 on Win2K sp4. After a few days of use (usually 4-5 days), Tomcat comes to a semi-halt mode and it refuses to process some of the pages. Even the thrown exceptions are not logged. It looks like it's a thread pool related problem because, apparently, the connector runs out of threads. I know that if an error occurs, the thread is supposed to be discarded from the pool to keep the consistency and the integrity however I don't understand why they aren't created again... Please have a look at the stack trace below. Any help/advice would be greatly appreciated! ;-) Thanks, Stack Trace follows: 2003-08-31 01:37:30 JspFactoryImpl: Exception initializing page context java.lang.IllegalStateException: Cannot create a session after the response has been committed at org.apache.coyote.tomcat4.CoyoteRequest.doGetSession(CoyoteRequest.java:1884) at org.apache.coyote.tomcat4.CoyoteRequest.getSession(CoyoteRequest.java:1731) at org.apache.coyote.tomcat4.CoyoteRequestFacade.getSession(CoyoteRequestFacade.java:365) at org.apache.coyote.tomcat4.CoyoteRequestFacade.getSession(CoyoteRequestFacade.java:375) at javax.servlet.http.HttpServletRequestWrapper.getSession(HttpServletRequestWrapper.java:268) at org.apache.jasper.runtime.PageContextImpl._initialize(PageContextImpl.java:138) at org.apache.jasper.runtime.PageContextImpl.initialize(PageContextImpl.java:114) at org.apache.jasper.runtime.JspFactoryImpl.internalGetPageContext(JspFactoryImpl.java:175) at org.apache.jasper.runtime.JspFactoryImpl.getPageContext(JspFactoryImpl.java:154) at includes.browsercheck_inc_jsp._jspService(browsercheck_inc_jsp.java:33) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:137) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:684) at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:575) at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:498) at org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:822) at applications.beninq_new_user_jsp._jspService(beninq_new_user_jsp.java:41) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:137) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2415) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643) at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223) at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:261) at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:360) at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:604) at
Re: IllegalStateException - org.apache.coyote.tomcat4.CoyoteRequest.doGetSession()
[EMAIL PROTECTED] wrote: Hi all, We're running Tomcat 4.1.24 on Win2K sp4. After a few days of use (usually 4-5 days), Tomcat comes to a semi-halt mode and it refuses to process some of the pages. Even the thrown exceptions are not logged. It looks like it's a thread pool related problem because, apparently, the connector runs out of threads. I know that if an error occurs, the thread is supposed to be discarded from the pool to keep the consistency and the integrity however I don't understand why they aren't created again... Please have a look at the stack trace below. Any help/advice would be greatly appreciated! ;-) Thanks, Stack Trace follows: 2003-08-31 01:37:30 JspFactoryImpl: Exception initializing page context java.lang.IllegalStateException: Cannot create a session after the response has been committed Well, this is a valid error, and doesn't indicate a problem. As for TC running out of threads, you should do a thread dump to see what's going on (ctrl+break on Windows in the TC console; I don't know how to do it if TC is running as a service). If the issues persist, you could test TC 5.0.9 beta, which has scalability improvements. Remy - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: IllegalStateException - org.apache.coyote.tomcat4.CoyoteRequest.doGetSession()
Well, this is a valid error, and doesn't indicate a problem. Remy, Thanks for your prompt answer. Please don't get me wrong, I don't want to sound arrogant or something, but how come an error may not indicate a problem. ;-) We've already gotten the thread dump. I'll have a look into that as well. Any more ideas? Anybody else maybe? :-) Thanks again, - Yagiz Erkan - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: IllegalStateException - org.apache.coyote.tomcat4.CoyoteRequest.doGetSession()
The stack trace you posted has to do with committing the reponse (which actually means sending data back to the client instead of sitting in a buffer), then trying to allocate a session. Allocating a NEW session involves sending a cookie back to the client to let the client be aware of the new session (so there may be a session). Well, cookies can NOT be created after the response has been committed since the header has already been sent to the client. So ... look into your code and determine where you you may create a new session. Then when that may occur, see if the state may have been previously committed for some reason. The servlet spec has more details about this. -Tim [EMAIL PROTECTED] wrote: Well, this is a valid error, and doesn't indicate a problem. Remy, Thanks for your prompt answer. Please don't get me wrong, I don't want to sound arrogant or something, but how come an error may not indicate a problem. ;-) We've already gotten the thread dump. I'll have a look into that as well. Any more ideas? Anybody else maybe? :-) Thanks again, - Yagiz Erkan - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: IllegalStateException - org.apache.coyote.tomcat4.CoyoteRequest.doGetSession()
[EMAIL PROTECTED] wrote: Thanks for your prompt answer. Please don't get me wrong, I don't want to sound arrogant or something, but how come an error may not indicate a problem. ;-) It indicates there's likely a bug in the app, not in TC (that's what I meant). You can't create a session if the response has already been committed (a flush or writing a relatively large amount of data would do that). We've already gotten the thread dump. I'll have a look into that as well. Any more ideas? Anybody else maybe? :-) Remy - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
IllegalStateException on JSP page
Hello all. I've got a simple JSP page which is throwing an IllegalStateException when I try to redirect the output to another page. Here is a snippet of the code: login = login.toUpperCase(); Connection myConnection = DriverManager.getConnection(url, login, password); String sessionId = session.getId(); Cookie cookie = new Cookie(sessionId, sessionId); response.addCookie(cookie); session.putValue(username, login); session.putValue(password, password); response.sendRedirect(rep_main.jsp); myConnection.close(); I've searched through all the archives and never was able to find a solution to this for my case. One thing I did read was about having to have a web.xml file for my application (I currently don't have one nor know what to put in one). If you think this is the problem could you forward a simple/basic web.xml? Thanks in advance, Kenny - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: IllegalStateException on JSP page
Kenny G. Dubuisson, Jr. wrote: Hello all. I've got a simple JSP page which is throwing an IllegalStateException when I try to redirect the output to another page. What is the stack trace? Here is a snippet of the code: login = login.toUpperCase(); Connection myConnection = DriverManager.getConnection(url, login, password); String sessionId = session.getId(); Cookie cookie = new Cookie(sessionId, sessionId); response.addCookie(cookie); session.putValue(username, login); session.putValue(password, password); response.sendRedirect(rep_main.jsp); myConnection.close(); I have found that debugging JSPs is a pain in the ass. If you can refactor this code to a servlet or even just some external Java objects (hint: you can then access the data from the JSP using JavaBeans), you can keep your JSP cleaner, which means less debugging of JSPs. I've searched through all the archives and never was able to find a solution to this for my case. One thing I did read was about having to have a web.xml file for my application (I currently don't have one nor know what to put in one). It is helpful to have this so you can specify context- and servlet- parameters as well as to perform servlet mappings. But I suppose if your app uses only JSPs it is not necessary? (Not sure.) If you think this is the problem could you forward a simple/basic web.xml? Thanks in advance, Sure, there is one at: http://jakarta.apache.org/tomcat/tomcat-4.1-doc/appdev/web.xml.txt Erik - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: IllegalStateException on JSP page
The full stack trace is: 2003-03-27 09:26:01 StandardWrapperValve[jsp]: Servlet.service() for servlet jsp threw exception java.lang.IllegalStateException at org.apache.catalina.connector.HttpResponseFacade.sendRedirect(HttpResponseFa cade.java:173) at org.apache.jsp.sales_0005frep$jsp._jspService(sales_0005frep$jsp.java:88) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.ja va:201) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:381) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:473) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application FilterChain.java:247) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh ain.java:193) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja va:243) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5 66) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja va:190) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5 66) at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:2 46) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5 64) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943) at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2347) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180 ) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5 66) at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve. java:170) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5 64) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170 ) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5 64) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:468) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5 64) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java :174) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5 66) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943) at org.apache.ajp.tomcat4.Ajp13Processor.process(Ajp13Processor.java:458) at org.apache.ajp.tomcat4.Ajp13Processor.run(Ajp13Processor.java:551) at java.lang.Thread.run(Thread.java:536) Hope this helps, Kenny - Original Message - From: Erik Price [EMAIL PROTECTED] To: Tomcat Users List [EMAIL PROTECTED] Sent: Thursday, March 27, 2003 9:51 AM Subject: Re: IllegalStateException on JSP page Kenny G. Dubuisson, Jr. wrote: Hello all. I've got a simple JSP page which is throwing an IllegalStateException when I try to redirect the output to another page. What is the stack trace? Here is a snippet of the code: login = login.toUpperCase(); Connection myConnection = DriverManager.getConnection(url, login, password); String sessionId = session.getId(); Cookie cookie = new Cookie(sessionId, sessionId); response.addCookie(cookie); session.putValue(username, login); session.putValue(password, password); response.sendRedirect(rep_main.jsp); myConnection.close(); I have found that debugging JSPs is a pain in the ass. If you can refactor this code to a servlet or even just some external Java objects (hint: you can then access the data from the JSP using JavaBeans), you can keep your JSP cleaner, which means less debugging of JSPs. I've searched through all the archives and never was able to find a solution to this for my case. One thing I did read was about having to have a web.xml file for my application (I currently don't have one nor know what to put in one). It is helpful to have this so you can specify context- and servlet
Re: IllegalStateException on JSP page
Kenny, I am not sure of my facts here, but I believe that response.sendRedirect() may close the response. If you then attempt to write to the response afterwards, you get an IllegalStateException. Since your code is in a JSP page, this causes problems - after Tomcat has processed the scriptlet, it will continue over the remainder of the page and output it to the client - any HTML tags, new lines or even white space after the end of the scriptlet will be written to the response. This will cause an exception. As someone has already stated here, this sort of code is much better suited to a Servlet. However, if you are looking for a quick and dirty fix, you could always add this HTML after the scriptlet: !doctype html public -//w3c//dtd html 3.2//en html head META http-equiv=refresh content=0; URL=[ENTER PAGE HERE} /head /html This will cause the browser to then request the new page which you specify. This is an awful way to solve the problem, but hopefully it helps... Ramsay Kenny G. Dubuisson, Jr. wrote: Hello all. I've got a simple JSP page which is throwing an IllegalStateException when I try to redirect the output to another page. Here is a snippet of the code: login = login.toUpperCase(); Connection myConnection = DriverManager.getConnection(url, login, password); String sessionId = session.getId(); Cookie cookie = new Cookie(sessionId, sessionId); response.addCookie(cookie); session.putValue(username, login); session.putValue(password, password); response.sendRedirect(rep_main.jsp); myConnection.close(); I've searched through all the archives and never was able to find a solution to this for my case. One thing I did read was about having to have a web.xml file for my application (I currently don't have one nor know what to put in one). If you think this is the problem could you forward a simple/basic web.xml? Thanks in advance, Kenny - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] A R K E M E D I A T E C H N O L O G I E S L T D VIEW POINTBASING VIEWBASINGSTOKEHAMPSHIRERG21 4RG http://www.arkemedia.com mailto:[EMAIL PROTECTED] Tel : +44 1256 869 200 Fax : +44 1256 329 119 The information in this e-mail and in any attachments is confidential and is intended solely for the attention and use of the named addressee(s). If you are not the intended recipient, or a person responsible for passing it on to the intended recipient, you are not authorised to hold a copy of this information and you must therefore not disclose, copy, distribute, or retain this message or any part of it. MAILTO:[EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: IllegalStateException on JSP page
Thanks for the info. The weird thing is that my JSP page worked fine for days and then it just stopped working. I've made no changes to it at all. I totally don't understand why it would have worked and then stopped. Thanks, Kenny - Original Message - From: Ramsay Domloge [EMAIL PROTECTED] To: Tomcat Users List [EMAIL PROTECTED] Sent: Thursday, March 27, 2003 10:36 AM Subject: Re: IllegalStateException on JSP page Kenny, I am not sure of my facts here, but I believe that response.sendRedirect() may close the response. If you then attempt to write to the response afterwards, you get an IllegalStateException. Since your code is in a JSP page, this causes problems - after Tomcat has processed the scriptlet, it will continue over the remainder of the page and output it to the client - any HTML tags, new lines or even white space after the end of the scriptlet will be written to the response. This will cause an exception. As someone has already stated here, this sort of code is much better suited to a Servlet. However, if you are looking for a quick and dirty fix, you could always add this HTML after the scriptlet: !doctype html public -//w3c//dtd html 3.2//en html head META http-equiv=refresh content=0; URL=[ENTER PAGE HERE} /head /html This will cause the browser to then request the new page which you specify. This is an awful way to solve the problem, but hopefully it helps... Ramsay Kenny G. Dubuisson, Jr. wrote: Hello all. I've got a simple JSP page which is throwing an IllegalStateException when I try to redirect the output to another page. Here is a snippet of the code: login = login.toUpperCase(); Connection myConnection = DriverManager.getConnection(url, login, password); String sessionId = session.getId(); Cookie cookie = new Cookie(sessionId, sessionId); response.addCookie(cookie); session.putValue(username, login); session.putValue(password, password); response.sendRedirect(rep_main.jsp); myConnection.close(); I've searched through all the archives and never was able to find a solution to this for my case. One thing I did read was about having to have a web.xml file for my application (I currently don't have one nor know what to put in one). If you think this is the problem could you forward a simple/basic web.xml? Thanks in advance, Kenny - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] A R K E M E D I A T E C H N O L O G I E S L T D VIEW POINTBASING VIEWBASINGSTOKEHAMPSHIRERG21 4RG http://www.arkemedia.com mailto:[EMAIL PROTECTED] Tel : +44 1256 869 200 Fax : +44 1256 329 119 The information in this e-mail and in any attachments is confidential and is intended solely for the attention and use of the named addressee(s). If you are not the intended recipient, or a person responsible for passing it on to the intended recipient, you are not authorised to hold a copy of this information and you must therefore not disclose, copy, distribute, or retain this message or any part of it. MAILTO:[EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: IllegalStateException on JSP page
I'm starting to think that my Tomcat installation is now broken. All of my code worked yesterday and now none of it works and I didn't change anything. Has anyone seen something like this before? I'm running Tomcat 4.0.6. I hate to reinstall everything on a whim but I don't know what else to do at this point. Thanks, Kenny - Original Message - From: Kenny G. Dubuisson, Jr. [EMAIL PROTECTED] To: Tomcat Users List [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Thursday, March 27, 2003 10:40 AM Subject: Re: IllegalStateException on JSP page Thanks for the info. The weird thing is that my JSP page worked fine for days and then it just stopped working. I've made no changes to it at all. I totally don't understand why it would have worked and then stopped. Thanks, Kenny - Original Message - From: Ramsay Domloge [EMAIL PROTECTED] To: Tomcat Users List [EMAIL PROTECTED] Sent: Thursday, March 27, 2003 10:36 AM Subject: Re: IllegalStateException on JSP page Kenny, I am not sure of my facts here, but I believe that response.sendRedirect() may close the response. If you then attempt to write to the response afterwards, you get an IllegalStateException. Since your code is in a JSP page, this causes problems - after Tomcat has processed the scriptlet, it will continue over the remainder of the page and output it to the client - any HTML tags, new lines or even white space after the end of the scriptlet will be written to the response. This will cause an exception. As someone has already stated here, this sort of code is much better suited to a Servlet. However, if you are looking for a quick and dirty fix, you could always add this HTML after the scriptlet: !doctype html public -//w3c//dtd html 3.2//en html head META http-equiv=refresh content=0; URL=[ENTER PAGE HERE} /head /html This will cause the browser to then request the new page which you specify. This is an awful way to solve the problem, but hopefully it helps... Ramsay Kenny G. Dubuisson, Jr. wrote: Hello all. I've got a simple JSP page which is throwing an IllegalStateException when I try to redirect the output to another page. Here is a snippet of the code: login = login.toUpperCase(); Connection myConnection = DriverManager.getConnection(url, login, password); String sessionId = session.getId(); Cookie cookie = new Cookie(sessionId, sessionId); response.addCookie(cookie); session.putValue(username, login); session.putValue(password, password); response.sendRedirect(rep_main.jsp); myConnection.close(); I've searched through all the archives and never was able to find a solution to this for my case. One thing I did read was about having to have a web.xml file for my application (I currently don't have one nor know what to put in one). If you think this is the problem could you forward a simple/basic web.xml? Thanks in advance, Kenny - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] A R K E M E D I A T E C H N O L O G I E S L T D VIEW POINTBASING VIEWBASINGSTOKEHAMPSHIRERG21 4RG http://www.arkemedia.com mailto:[EMAIL PROTECTED] Tel : +44 1256 869 200 Fax : +44 1256 329 119 The information in this e-mail and in any attachments is confidential and is intended solely for the attention and use of the named addressee(s). If you are not the intended recipient, or a person responsible for passing it on to the intended recipient, you are not authorised to hold a copy of this information and you must therefore not disclose, copy, distribute, or retain this message or any part of it. MAILTO:[EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: IllegalStateException on JSP page
On Thu, 27 Mar 2003, Kenny G. Dubuisson, Jr. wrote: Date: Thu, 27 Mar 2003 09:43:45 -0600 From: Kenny G. Dubuisson, Jr. [EMAIL PROTECTED] Reply-To: Tomcat Users List [EMAIL PROTECTED] To: Tomcat Users List [EMAIL PROTECTED] Subject: IllegalStateException on JSP page Hello all. I've got a simple JSP page which is throwing an IllegalStateException when I try to redirect the output to another page. Here is a snippet of the code: login = login.toUpperCase(); Connection myConnection = DriverManager.getConnection(url, login, password); String sessionId = session.getId(); Cookie cookie = new Cookie(sessionId, sessionId); response.addCookie(cookie); session.putValue(username, login); session.putValue(password, password); response.sendRedirect(rep_main.jsp); myConnection.close(); I've searched through all the archives and never was able to find a solution to this for my case. One thing I did read was about having to have a web.xml file for my application (I currently don't have one nor know what to put in one). If you think this is the problem could you forward a simple/basic web.xml? Thanks in advance, Kenny Getting an IllegalStateException is exactly what should happen if the response has already been committed back to the client before this code is executed. When the response has been committed (because you've already written more characters than the size of the response buffer), the HTTP headers have already been sent -- and it is no longer possible to do a redirect. Craig - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
IllegalStateException
Hello, i use tomcat 4.0.6, cocoon 2.0.4, Oracle 8, NT4.0 i got this exception: 2003-01-15 15:53:33 StandardWrapperValve[OMSWebgate]: Servlet.service() for servlet OMSWebgate threw exception java.lang.IllegalStateException at org.apache.catalina.connector.ResponseFacade.reset(ResponseFacade.java:243) at org.apache.cocoon.servlet.CocoonServlet.service(CocoonServlet.java:1074) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application FilterChain.java:247) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh ain.java:193) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja va:243) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5 66) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja va:190) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5 66) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase .java:531) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5 64) at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:2 46) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5 64) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943) at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2347) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180 ) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5 66) at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve. java:170) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5 64) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170 ) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5 64) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:468) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5 64) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java :174) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5 66) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943) at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java: 1027) at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1125 ) at java.lang.Thread.run(Thread.java:536) can anybody tell me what is wrong? thank you very much, best regards Diese E-Mail enthält vertrauliche und/oder rechtlich geschützte Informationen. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtümlich erhalten haben, informieren Sie bitte sofort den Absender und vernichten Sie diese Mail. Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser Mail ist nicht gestattet. This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden.
[repeat] IllegalStateException??? Please help!
I've set up a SSL socket in Tomcat and everything appears to work okay. I can connect to the port, install the cert and access the site. However, when I access the HTTPS port with my browser and get the 'Security Alert' prompt telling me about the certificate and asking me if I want to continue, then I get the following message scrolling continually within the Tomcat window. 2002-11-20 15:25:31 - Ctx( ): IllegalStateException in: R( /) Current state = F LUSHED, new state = CODING 2002-11-20 15:25:31 - Ctx( ): IllegalStateException in: R( /) Current state = F LUSHED, new state = CODING 2002-11-20 15:25:31 - Ctx( ): IllegalStateException in: R( /) Current state = F LUSHED, new state = CODING Can anybody tell me what this means and how I might prevent it from happening? Thanks Steve -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
IllegalStateException??? Please help!
I've set up a SSL socket in Tomcat and everything appears to work okay. I can connect to the port, install the cert and access the site. However, when I access the HTTPS port with my browser and get the 'Security Alert' prompt telling me about the certificate and asking me if I want to continue, then I get the following message scrolling continually within the Tomcat window. 2002-11-20 15:25:31 - Ctx( ): IllegalStateException in: R( /) Current state = F LUSHED, new state = CODING 2002-11-20 15:25:31 - Ctx( ): IllegalStateException in: R( /) Current state = F LUSHED, new state = CODING 2002-11-20 15:25:31 - Ctx( ): IllegalStateException in: R( /) Current state = F LUSHED, new state = CODING Can anybody tell me what this means and how I might prevent it from happening? Thanks Steve -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: IllegalStateException??? Please help!
Johan, Thanks for your reply. I've restarted Tomcat but that seems to be when the problem happens. (I say problem though it isn't affecting the program!) And I'm not using servlets. Thanks anyway, Let me know if you have anymore thoughts. Cheers, Steve -Original Message- From: Johan Bryssling [mailto:[EMAIL PROTECTED]] Sent: 26 November 2002 15:07 To: Tomcat Users List Subject: RE: IllegalStateException??? Please help! Hi.. Compiled servlets recently? Try restart tomcat and reconnect... The problem sometimes happens to me when I compile servlets and try to access them direct after. The solution is to restart tomcat (in that case). Perhaps your case is similar. Regards /Johan -Original Message- From: Steve Beech [mailto:[EMAIL PROTECTED]] Sent: den 26 november 2002 12:02 To: 'Tomcat Users List' Subject: IllegalStateException??? Please help! I've set up a SSL socket in Tomcat and everything appears to work okay. I can connect to the port, install the cert and access the site. However, when I access the HTTPS port with my browser and get the 'Security Alert' prompt telling me about the certificate and asking me if I want to continue, then I get the following message scrolling continually within the Tomcat window. 2002-11-20 15:25:31 - Ctx( ): IllegalStateException in: R( /) Current state = F LUSHED, new state = CODING 2002-11-20 15:25:31 - Ctx( ): IllegalStateException in: R( /) Current state = F LUSHED, new state = CODING 2002-11-20 15:25:31 - Ctx( ): IllegalStateException in: R( /) Current state = F LUSHED, new state = CODING Can anybody tell me what this means and how I might prevent it from happening? Thanks Steve -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
IllegalStateException.... Current state = FLUSHED, new state =
Hi, I have this peculiar problem on my production version of Tomcat 3.1 and sadly I can't replicate this on my test server ;-( I keep getting this error 2002-11-06 14:35:45 - Ctx( /transformer ): IllegalStateException in: R( /transformer + /servlet/transformer + null) Current state = FLUSHED, new state = CODING appear in my tomcat jmv.stderr log file over and over again until this server crashes out of memory. I have got a servlet that does some processing and constructs an xml document which then gets passed to a transforming servlet along with the location of an xsl file as attributes. This error is being caused by the transform servlet it seems. Other info. Running IIS4 using Tomcat as NT service using isapi director which also gets loads of errors. Don't know if they are connected [jk_connect.c (143)]: jk_open_socket, connect() failed errno = 61 [jk_ajp12_worker.c (152)]: In jk_endpoint_t::service, Error sd = -1 [jk_isapi_plugin.c (554)]: HttpExtensionProc error, service() failed The static files i.e. .xsl file is being served up by IIS Any suggestions would be very welcome as I say this is now in production and crashing Tomcat several time a day. TIA Conrad Source code for servlet import javax.xml.transform.stream.StreamSource; import javax.xml.transform.stream.StreamResult; import javax.xml.transform.dom.DOMSource; import javax.xml.transform.Transformer; import javax.xml.transform.TransformerFactory; import javax.servlet.*; import javax.servlet.http.*; import java.io.*; import java.util.*; import org.w3c.dom.Document; public class transformer extends HttpServlet { /** * Initialize global variables */ public void init(ServletConfig config) throws ServletException { super.init(config); } /** * Process the HTTP Get request */ public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType(text/html; charset=WINDOWS-1252); PrintWriter out = response.getWriter(); Document doc = null; String xsl = null; try { doc = (Document) request.getAttribute(xml); xsl = (String) request.getAttribute(xsl); TransformerFactory factory = TransformerFactory.newInstance(); Transformer transformer = factory.newTransformer(new StreamSource(xsl)); // Transformer transformer = factory.newTransformer(); transformer.transform(new DOMSource(doc), new StreamResult(out)); } catch (Exception e) { e.printStackTrace(); } out.close(); } } Thanks Conrad -- To unsubscribe, e-mail: mailto:tomcat-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:tomcat-user-help;jakarta.apache.org
Re: IllegalStateException Error
try reset() ing the response before sending the redirect. You should not write to the response object if you are going to redirect/forward it to another resources that will output to the response object. response.reset(); also redirecting will not stop the thread from executing the remainder of the code so you should put in a return statement after the redirect On Thu, 2002-10-17 at 11:12, Lior Shliechkorn wrote: From:Carl [EMAIL PROTECTED] on 10/17/2002 09:12 AM MST I'm trying to do some checking on my pages that make sure that the user logged out and all the attributes that were bounded to the session were destroyed (using session.invalidate() in the logout page). However, I'm running into difficulties with 1 of my pages. The check works fine on all the other pages except this one. I try to response.sendRedirect() the page to the login page again, but it seems to ignore it and I get errors that I can't forward after a response has been committed. And other times it logs the user right back in as if nothing happened after the user logged out...it's only with this one page. here's the code. I'm not sure what could be wrong: %@ page session=true % %@ page contentType=text/html;charset=WINDOWS-1252 % %@ page import = java.util.*, java.sql.*, java.util.Vector.* % jsp:useBean id=pool class=ConnectionPool scope=application / % response.setHeader(pragma, no-cache); response.setHeader(Cache-Control, no-cache); response.setHeader(Expires, 0); Connection conn = null; String asql = null; Statement stmt = null; ResultSet rs = null; String aUserID = null; String aPassword = null; try { FB user = (FB) session.getAttribute(bean); //*** // FormBean Exists //*** if (user != null) { aUserID = user.getUSER_ID(); aPassword = user.getPASSWORD(); } //*** // No session bean exists //*** else { response.sendRedirect(../html/ReLogin.html); } // // INITIALIZE THE POOL // if (pool.getDriver() == null) { pool.init(); pool.initializePool();
IllegalStateException Error
I'm trying to do some checking on my pages that make sure that the user logged out and all the attributes that were bounded to the session were destroyed (using session.invalidate() in the logout page). However, I'm running into difficulties with 1 of my pages. The check works fine on all the other pages except this one. I try to response.sendRedirect() the page to the login page again, but it seems to ignore it and I get errors that I can't forward after a response has been committed. And other times it logs the user right back in as if nothing happened after the user logged out...it's only with this one page. here's the code. I'm not sure what could be wrong: % page session=true % % page contentType=text/html;charset=WINDOWS-1252 % % page import = java.util.*, java.sql.*, java.util.Vector.* % jsp:useBean id=pool class=ConnectionPool scope=application / % response.setHeader(pragma, no-cache); response.setHeader(Cache-Control, no-cache); response.setHeader(Expires, 0); Connection conn = null; String asql = null; Statement stmt = null; ResultSet rs = null; String aUserID = null; String aPassword = null; try { FB user = (FB) session.getAttribute(bean); //*** // FormBean Exists //*** if (user != null) { aUserID = user.getUSER_ID(); aPassword = user.getPASSWORD(); } //*** // No session bean exists //*** else { response.sendRedirect(../html/ReLogin.html); } // // INITIALIZE THE POOL // if (pool.getDriver() == null) { pool.init(); pool.initializePool(); } boolean aloginflag = false; conn = pool.getConnection(); stmt = conn.createStatement(); asql = getSqlStatement(); System.out.println(asql); String accesscode = null; rs = stmt.executeQuery(asql); while (rs.next()) { aloginflag = true; System.out.println(Login successful!); accesscode = rs.getString(ACCESS_CODE); user.setACCESSCODE(accesscode); System.out.println(accesscode); } // end while if(aloginflag) {} else { % jsp:forward page=../html/LoginError.html/jsp:forward % } if (accesscode.equalsIgnoreCase(B)) { % jsp:forward page=daily.jsp/jsp:forward % } // end if else if (accesscode.equalsIgnoreCase(C)) { % jsp:forward page=report2.jsp/jsp:forward % } // end else if else if (accesscode.equalsIgnoreCase(G)) { % jsp:forward page=report.jsp/jsp:forward % } // end else if else if (accesscode.equalsIgnoreCase(U)) { % jsp:forward page=news.jsp/jsp:forward % } // end else if else { System.out.println(No account found in the database!); response.sendRedirect(../html/LoginError.html); } // end else } catch(SQLException e) { // Login SQL Error! response.sendRedirect(../html/LoginError.html); } catch(ClassNotFoundException e) { // Classname Error! response.sendRedirect(../html/DBConnError.html); } finally { try { if (stmt != null) stmt.close(); if (rs != null) rs.close(); if (conn != null ) pool.releaseConnection(conn); } catch (Exception sqlex) { response.sendRedirect(../html/LoginError.html); } } % I find that it totally disregards the lines after the TRY statement and even after I log out I can still see that when I hit the back button it process the sql query and doesn't redirect. I tried to change the else (after the aloginflag) to a response.sendRedirect() and the page breaks... What am I doing wrong? Thanks, Lior - Do you Yahoo!? Faith Hill - Exclusive Performances, Videos, more faith.yahoo.com
RE: IllegalStateException Error
ok, several problems here: 1. place a 'return;' after your sendRedirect() 2. remove unintended whitespace from your jsp: change % jsp:forward page=daily.jsp/jsp:forward % to %jsp:forward page=daily.jsp/jsp:forward% 3. post your error messages with stack trace. I happen to recognize 'response already committed', but others may not. 4. search the archives: http://www.mail-archive.com/tomcat-user%40jakarta.apache.org/ Illegalstateexception returns many hits and 'response already committed' returns more specific to your problem. These will probably give you more detail than I can remember right now. #3 and #4 will help you get an answer quicker. Please also remember that not everyone gets to all messages on the list within the 3 hours that you have allowed. Charlie -Original Message- From: Lior Shliechkorn [mailto:liorshliech;yahoo.com] Sent: Thursday, October 17, 2002 12:12 PM To: Tomcat Subject: IllegalStateException Error I'm trying to do some checking on my pages that make sure that the user logged out and all the attributes that were bounded to the session were destroyed (using session.invalidate() in the logout page). However, I'm running into difficulties with 1 of my pages. The check works fine on all the other pages except this one. I try to response.sendRedirect() the page to the login page again, but it seems to ignore it and I get errors that I can't forward after a response has been committed. And other times it logs the user right back in as if nothing happened after the user logged out...it's only with this one page. here's the code. I'm not sure what could be wrong: % page session=true % % page contentType=text/html;charset=WINDOWS-1252 % % page import = java.util.*, java.sql.*, java.util.Vector.* % jsp:useBean id=pool class=ConnectionPool scope=application / % response.setHeader(pragma, no-cache); response.setHeader(Cache-Control, no-cache); response.setHeader(Expires, 0); Connection conn = null; String asql = null; Statement stmt = null; ResultSet rs = null; String aUserID = null; String aPassword = null; try { FB user = (FB) session.getAttribute(bean); //*** // FormBean Exists //*** if (user != null) { aUserID = user.getUSER_ID(); aPassword = user.getPASSWORD(); } //*** // No session bean exists //*** else { response.sendRedirect(../html/ReLogin.html); } // // INITIALIZE THE POOL // if (pool.getDriver() == null) { pool.init(); pool.initializePool(); } boolean aloginflag = false; conn = pool.getConnection(); stmt = conn.createStatement(); asql = getSqlStatement(); System.out.println(asql); String accesscode = null; rs = stmt.executeQuery(asql); while (rs.next()) { aloginflag = true; System.out.println(Login successful!); accesscode = rs.getString(ACCESS_CODE); user.setACCESSCODE(accesscode); System.out.println(accesscode); } // end while if(aloginflag) {} else { % jsp:forward page=../html/LoginError.html/jsp:forward % } if (accesscode.equalsIgnoreCase(B)) { % jsp:forward page=daily.jsp/jsp:forward % } // end if else if (accesscode.equalsIgnoreCase(C)) { % jsp:forward page=report2.jsp/jsp:forward % } // end else if else if (accesscode.equalsIgnoreCase(G)) { % jsp:forward page=report.jsp/jsp:forward % } // end else if else if (accesscode.equalsIgnoreCase(U)) { % jsp:forward page=news.jsp/jsp:forward % } // end else if else { System.out.println(No account found in the database!); response.sendRedirect(../html/LoginError.html); } // end else } catch(SQLException e) { // Login SQL Error! response.sendRedirect(../html/LoginError.html); } catch(ClassNotFoundException e) { // Classname Error! response.sendRedirect(../html/DBConnError.html); } finally { try { if (stmt != null) stmt.close(); if (rs != null) rs.close(); if (conn != null ) pool.releaseConnection(conn); } catch (Exception sqlex) { response.sendRedirect(../html/LoginError.html); } } % I find that it totally disregards
RE: IllegalStateException Error
The return works. Thanks. I still really don't understand what was happening that it was committing the response. It was giving me a java.lang.IllegalStateException : cannot forward response has been committed... And it only gives me this error on this page...the other pages have the same exact code with checking the session beans and it works. Strange. Cox, Charlie [EMAIL PROTECTED] wrote:ok, several problems here: 1. place a 'return;' after your sendRedirect() 2. remove unintended whitespace from your jsp: change % to % 3. post your error messages with stack trace. I happen to recognize 'response already committed', but others may not. 4. search the archives: http://www.mail-archive.com/tomcat-user%40jakarta.apache.org/ Illegalstateexception returns many hits and 'response already committed' returns more specific to your problem. These will probably give you more detail than I can remember right now. #3 and #4 will help you get an answer quicker. Please also remember that not everyone gets to all messages on the list within the 3 hours that you have allowed. Charlie -Original Message- From: Lior Shliechkorn [mailto:liorshliech;yahoo.com] Sent: Thursday, October 17, 2002 12:12 PM To: Tomcat Subject: IllegalStateException Error I'm trying to do some checking on my pages that make sure that the user logged out and all the attributes that were bounded to the session were destroyed (using session.invalidate() in the logout page). However, I'm running into difficulties with 1 of my pages. The check works fine on all the other pages except this one. I try to response.sendRedirect() the page to the login page again, but it seems to ignore it and I get errors that I can't forward after a response has been committed. And other times it logs the user right back in as if nothing happened after the user logged out...it's only with this one page. here's the code. I'm not sure what could be wrong: response.setHeader(pragma, no-cache); response.setHeader(Cache-Control, no-cache); response.setHeader(Expires, 0); Connection conn = null; String asql = null; Statement stmt = null; ResultSet rs = null; String aUserID = null; String aPassword = null; try { FB user = (FB) session.getAttribute(bean); //*** // FormBean Exists //*** if (user != null) { aUserID = user.getUSER_ID(); aPassword = user.getPASSWORD(); } //*** // No session bean exists //*** else { response.sendRedirect(../html/ReLogin.html); } // // INITIALIZE THE POOL // if (pool.getDriver() == null) { pool.init(); pool.initializePool(); } boolean aloginflag = false; conn = pool.getConnection(); stmt = conn.createStatement(); asql = getSqlStatement(); System.out.println(asql); String accesscode = null; rs = stmt.executeQuery(asql); while (rs.next()) { aloginflag = true; System.out.println(Login successful!); accesscode = rs.getString(ACCESS_CODE); user.setACCESSCODE(accesscode); System.out.println(accesscode); } // end while if(aloginflag) {} else { % } if (accesscode.equalsIgnoreCase(B)) { % } // end if else if (accesscode.equalsIgnoreCase(C)) { % } // end else if else if (accesscode.equalsIgnoreCase(G)) { % } // end else if else if (accesscode.equalsIgnoreCase(U)) { % } // end else if else { System.out.println(No account found in the database!); response.sendRedirect(../html/LoginError.html); } // end else } catch(SQLException e) { // Login SQL Error! response.sendRedirect(../html/LoginError.html); } catch(ClassNotFoundException e) { // Classname Error! response.sendRedirect(../html/DBConnError.html); } finally { try { if (stmt != null) stmt.close(); if (rs != null) rs.close(); if (conn != null ) pool.releaseConnection(conn); } catch (Exception sqlex) { response.sendRedirect(../html/LoginError.html); } } % I find that it totally disregards the lines after the TRY statement and even after I log out I can still see that when I hit the back button it process the sql query and doesn't
AW: IllegalStateException Error
Because there are some factors that vary with every page to . - The size of output created by the caller of forward - The time the caller needs to create the output - The time that tomcat needs between calling forward and performing the check if the response has already been committed Note that the last 2 factors may vary depending on the load of the server. -Ursprüngliche Nachricht- Von: Lior Shliechkorn [mailto:liorshliech;yahoo.com] Gesendet: Donnerstag, 17. Oktober 2002 23:13 An: Tomcat Users List Betreff: RE: IllegalStateException Error The return works. Thanks. I still really don't understand what was happening that it was committing the response. It was giving me a java.lang.IllegalStateException : cannot forward response has been committed... And it only gives me this error on this page...the other pages have the same exact code with checking the session beans and it works. Strange. -- To unsubscribe, e-mail: mailto:tomcat-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:tomcat-user-help;jakarta.apache.org
IllegalStateException...
I'm trying to do some checking on my pages that make sure that the user logged out and all the attributes that were bounded to the session were destroyed (using session.invalidate() in the logout page). However, I'm running into difficulties with 1 of my pages. The check works fine on all the other pages except this one. I try to response.sendRedirect() the page to the login page again, but it seems to ignore it and I get errors that I can't forward after a response has been committed. And other times it logs the user right back in as if nothing happened after the user logged out...it's only with this one page. here's the code. I'm not sure what could be wrong: % page session=true % % page contentType=text/html;charset=WINDOWS-1252 % % page import = java.util.*, java.sql.*, java.util.Vector.* % jsp:useBean id=pool class=ConnectionPool scope=application / % response.setHeader(pragma, no-cache); response.setHeader(Cache-Control, no-cache); response.setHeader(Expires, 0); Connection conn = null; String asql = null; Statement stmt = null; ResultSet rs = null; String aUserID = null; String aPassword = null; try { FB user = (FB) session.getAttribute(bean); //*** // FormBean Exists //*** if (user != null) { aUserID = user.getUSER_ID(); aPassword = user.getPASSWORD(); } //*** // No session bean exists //*** else { response.sendRedirect(../html/ReLogin.html); } // // INITIALIZE THE POOL // if (pool.getDriver() == null) { pool.init(); pool.initializePool(); } boolean aloginflag = false; conn = pool.getConnection(); stmt = conn.createStatement(); asql = getSqlStatement(); System.out.println(asql); String accesscode = null; rs = stmt.executeQuery(asql); while (rs.next()) { aloginflag = true; System.out.println(Login successful!); accesscode = rs.getString(ACCESS_CODE); user.setACCESSCODE(accesscode); System.out.println(accesscode); } // end while if(aloginflag) {} else { % jsp:forward page=../html/LoginError.html/jsp:forward % } if (accesscode.equalsIgnoreCase(B)) { % jsp:forward page=daily.jsp/jsp:forward % } // end if else if (accesscode.equalsIgnoreCase(C)) { % jsp:forward page=report2.jsp/jsp:forward % } // end else if else if (accesscode.equalsIgnoreCase(G)) { % jsp:forward page=report.jsp/jsp:forward % } // end else if else if (accesscode.equalsIgnoreCase(U)) { % jsp:forward page=news.jsp/jsp:forward % } // end else if else { System.out.println(No account found in the database!); response.sendRedirect(../html/LoginError.html); } // end else } catch(SQLException e) { // Login SQL Error! response.sendRedirect(../html/LoginError.html); } catch(ClassNotFoundException e) { // Classname Error! response.sendRedirect(../html/DBConnError.html); } finally { try { if (stmt != null) stmt.close(); if (rs != null) rs.close(); if (conn != null ) pool.releaseConnection(conn); } catch (Exception sqlex) { response.sendRedirect(../html/LoginError.html); } } % I find that it totally disregards the lines after the TRY statement and even after I log out I can still see that when I hit the back button it process the sql query and doesn't redirect. I tried to change the else (after the aloginflag) to a response.sendRedirect() and the page breaks... What am I doing wrong? Thanks, Lior - Do you Yahoo!? Faith Hill - Exclusive Performances, Videos, more faith.yahoo.com
Re: IllegalStateException while using SSL
In general, you get better responses if you mention which Tomcat version you are using. Having spent way too much time on this list :), I'm guessing that you are using a 3.2.x version. If possible you should try upgrading to at least 3.3.1 (and, for HTTPS, upgrade to the CoyoteConnector to take advantage of keep-alive). hari@acusis [EMAIL PROTECTED] wrote in message 00be01c2562a$bae17c70$fa00a8c0@faustbuch">news:00be01c2562a$bae17c70$fa00a8c0@faustbuch... Hi, I setup SSL in Tomcat using JSEE and the key is generated using the keytool utility. The system is working fine, but the server is throwing an IllegalStateException continuously while accessing any page through HTTPS. This never stops and after few minutes of throwing the exception, it gices an OutOfMemory error and stops there. [Till then it successfully serves all pages through HTTPS]. The exception thrown is copied below. 2002-09-07 10:11:24 - Ctx( ): IllegalStateException in: R( /) Current state = FLUSHED, new state = CODING Any ideas why this is happening and how to resolve this? Thx, Hari. -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
IllegalStateException while using SSL
Hi, I setup SSL in Tomcat using JSEE and the key is generated using the keytool utility. The system is working fine, but the server is throwing an IllegalStateException continuously while accessing any page through HTTPS. This never stops and after few minutes of throwing the exception, it gices an OutOfMemory error and stops there. [Till then it successfully serves all pages through HTTPS]. The exception thrown is copied below. 2002-09-07 10:11:24 - Ctx( ): IllegalStateException in: R( /) Current state = FLUSHED, new state = CODING Any ideas why this is happening and how to resolve this? Thx, Hari.
RE: Error : Why IllegalStateException ?
Well, I sometimes get this error with my error page, which only gets called by Tomcat. This is what's in web.xml. error-page exception-typejava.lang.Exception/exception-type location/error/er500.jsp/location /error-page If the stream has already been closed, I think then this is a Tomcat error. I am not sure how I could fix this. -Original Message- From: Ralph Einfeldt [mailto:[EMAIL PROTECTED]] Sent: Wednesday, July 24, 2002 4:35 AM To: Tomcat Users List Subject: AW: Error : Why IllegalStateException ? That's not a problem of web.xml. What make you think it is? (That kind of problem wouldn't be resolved by a restart) The typical reason for an IllegalStateException is that you (or any component that you use) try to write something to a response or a stream that already has bean closed (flushed). -Ursprüngliche Nachricht- Von: jose saloio [mailto:[EMAIL PROTECTED]] Gesendet: Mittwoch, 24. Juli 2002 10:21 An: [EMAIL PROTECTED] Betreff: Error : Why IllegalStateException ? I have this error: Current state = FLUSHED, new state = CODING 7-10 11:09:48 - Ctx( /test): IllegalStateException in: R( /test+) Current -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Error Tomcat : Why IllegalStateException
I have this message : Current state = FLUSHED, new state = CODING 7-10 11:09:48 - Ctx( /test): IllegalStateException in: R( /test+) Current state = FLUSHED, new state = CODING 7-10 11:09:48 - Ctx( /kalima ): IllegalStateException in: R( /test+) Current state = FLUSHED, new state = CODING 7-10 11:09:48 - Ctx( /kalima ): IllegalStateException in: R( /test+) ++ again others !!! For stop this message, I must to stop Tomcat3.2.4. I don't understand why have I this error message and how can I solve this problem. Thank you, jose. _ Discutez en ligne avec vos amis ! http://messenger.msn.fr -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Tomcat 3.2.3 - tomcat 4.0.4 upgrade producing IllegalStateException??
Can any one cast any light on the following? We've just upgraded from Tomcat 3.2.3 to Tomcat 4.0.4 running alongside IIS4 on NT4 (jdk1.3.1_01) All's proceeding fine except two of the webapps I'm transferring to the new Tomcat are refusing to play nicely, spitting variations on the following errors. Both these apps begin with login checks and redirect, if the user is not currently logged in, to an authentication screen. However we're not getting that far. Searching across the web has brought up a few instances where Tomcat 4.0.4 may have had issues with redirects in certain circumstances, can anyone fill me in some more on what might be going on here? Any assistance gratefully accepted. Cheers Tref Gare java.lang.IllegalStateException at org.apache.jasper.runtime.ServletResponseWrapperInclude.getOutputStream(Serv letResponseWrapperInclude.java:109) at org.apache.catalina.servlets.DefaultServlet.serveResource(DefaultServlet.jav a:1146) at org.apache.catalina.servlets.DefaultServlet.doGet(DefaultServlet.java:519) at javax.servlet.http.HttpServlet.service(HttpServlet.java:740) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher. java:683) at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatch er.java:574) at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher .java:497) at org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:8 19) at org.apache.jsp.login$jsp._jspService(login$jsp.java:88) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.ja va:201) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:381) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:473) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher. java:683) at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatch er.java:431) at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher .java:355) at org.apache.jasper.runtime.PageContextImpl.forward(PageContextImpl.java:414) at org.apache.jsp.default$jsp._jspService(default$jsp.java:166) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.ja va:201) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:381) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:473) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application FilterChain.java:247) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh ain.java:193) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja va:243) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5 66) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja va:190) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5 66) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943) at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2347) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180 ) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5 66) at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve. java:170) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5 64) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170 ) at
Commons Collections, Pool and DBCP - IllegalStateException
Craig, I had the chance today to follow your instruction for installation of the Commons project Collections, Pool and DBCP. I downloaded the March 24 nightly of each and moved the appropriate jars into the $CATALINA_HOME/common/lib directory. I changed the Resource-params as indicated to: parameter namefactory/name valueorg.apache.commons.dbcp.BasicDataSourceFactory/value /parameter I am using the the Resource for a virtual host context. I have double checked to be sure that the code runs using the default Tomcat (4.0.3) datasource factory. Starting up Tomcat and no exceptions are reported in either the catalina or the virtual_host log files. But when I access the resource (via a servlet for login authorization) I get the following exception: begin- 2002-03-24 17:55:05 StandardWrapperValve[invoker]: Servlet.service() for servlet invoker threw exception java.lang.IllegalStateException at org.apache.catalina.connector.HttpResponseFacade.sendRedirect(HttpResponseFa cade.java:173) at AdminLogin.doGet(AdminLogin.java:44) at AdminLogin.doPost(AdminLogin.java:54) at javax.servlet.http.HttpServlet.service(HttpServlet.java:760) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.catalina.servlets.InvokerServlet.serveRequest(InvokerServlet.java :446) at org.apache.catalina.servlets.InvokerServlet.doPost(InvokerServlet.java:216) at javax.servlet.http.HttpServlet.service(HttpServlet.java:760) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application FilterChain.java:247) snip end-- If you need the rest let me know. Got any ideas where to begin? I would like to use the DBCP package as a model. Thanks, Steven -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED]
Re: How can I resolve this IllegalStateException: Response has alrea dy been committed problem?
we had encountered the same problem... the solution is to clear the output buffer before re-directing the page in case of errors, u need to put the following out.clearBuffer(); before your re-directions... --- [EMAIL PROTECTED] wrote: [TOMCAT-3.3 JDK 1.3.1 WIN 2000] Hi everyone, I have a webapp that consists of various servlets - each of which is associated with one or more JSPs. The way it works is that someone logs in (by calling a servlet which forwards them to the JSP form). This servlet then processes the input and then (upon successful authorisation) forwards control to another servlet (which then displays another JSP and handles user requests from this JSP). This servlet then processes the user requests and forwards control to the relevant servlet, which then forwards them to a JSP page. My application is working just fine, apart from the fact that I keep getting these annoying IllegalStateExceptions. Here is the full exception: 2002-03-08 11:20:55 - Ctx(/AgentGenerator) : IllegalStateException in R( /AgentGenerator + /servlet/Create + null) - java.lang.IllegalStateException: Response has already been committed at org.apache.tomcat.facade.HttpServletResponseFacade.sendError(Unknown Source) at org.apache.tomcat.facade.HttpServletResponseFacade.sendRedirect(Unknown Source) at zeus.generator.web.controllers.Home.goToAddress(Home.java:163) at zeus.generator.web.controllers.Home.processRequest(Home.java:120) at zeus.generator.web.controllers.Home.doGet(Home.java:131) at javax.servlet.http.HttpServlet.service(HttpServlet.java) at javax.servlet.http.HttpServlet.service(HttpServlet.java) at org.apache.tomcat.facade.ServletHandler.doService(Unknown Source) at org.apache.tomcat.core.Handler.invoke(Unknown Source) at org.apache.tomcat.core.Handler.service(Unknown Source) at org.apache.tomcat.facade.ServletHandler.service(Unknown Source) at org.apache.tomcat.core.ContextManager.internalService(Unknown Source) at org.apache.tomcat.core.ContextManager.service(Unknown Source) at org.apache.tomcat.modules.server.Http10Interceptor.processConnection(Unknown Source) at org.apache.tomcat.util.net.TcpWorkerThread.runIt(Unknown Source) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(Unknown Source) at java.lang.Thread.run(Thread.java:484) 2002-03-08 11:20:55 - ErrorHandler: Error loop for R( /AgentGenerator + /servlet/Create + null) error java.lang.IllegalS tateException: Response has already been committed I have tried (and tried, and tried, ...) to find some information on the web, but have yet to find a solution. It seems I can't forward more than once from the same servlet, but I'm not even sure if I'm right about that. If anyone can shed any light on this issue it would be most appreciated. Thanks, Lindsay -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED] __ Do You Yahoo!? Try FREE Yahoo! Mail - the world's greatest free email! http://mail.yahoo.com/ -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED]
How can I resolve this IllegalStateException: Response has alrea dy been committed problem?
[TOMCAT-3.3 JDK 1.3.1 WIN 2000] Hi everyone, I have a webapp that consists of various servlets - each of which is associated with one or more JSPs. The way it works is that someone logs in (by calling a servlet which forwards them to the JSP form). This servlet then processes the input and then (upon successful authorisation) forwards control to another servlet (which then displays another JSP and handles user requests from this JSP). This servlet then processes the user requests and forwards control to the relevant servlet, which then forwards them to a JSP page. My application is working just fine, apart from the fact that I keep getting these annoying IllegalStateExceptions. Here is the full exception: 2002-03-08 11:20:55 - Ctx(/AgentGenerator) : IllegalStateException in R( /AgentGenerator + /servlet/Create + null) - java.lang.IllegalStateException: Response has already been committed at org.apache.tomcat.facade.HttpServletResponseFacade.sendError(Unknown Source) at org.apache.tomcat.facade.HttpServletResponseFacade.sendRedirect(Unknown Source) at zeus.generator.web.controllers.Home.goToAddress(Home.java:163) at zeus.generator.web.controllers.Home.processRequest(Home.java:120) at zeus.generator.web.controllers.Home.doGet(Home.java:131) at javax.servlet.http.HttpServlet.service(HttpServlet.java) at javax.servlet.http.HttpServlet.service(HttpServlet.java) at org.apache.tomcat.facade.ServletHandler.doService(Unknown Source) at org.apache.tomcat.core.Handler.invoke(Unknown Source) at org.apache.tomcat.core.Handler.service(Unknown Source) at org.apache.tomcat.facade.ServletHandler.service(Unknown Source) at org.apache.tomcat.core.ContextManager.internalService(Unknown Source) at org.apache.tomcat.core.ContextManager.service(Unknown Source) at org.apache.tomcat.modules.server.Http10Interceptor.processConnection(Unknown Source) at org.apache.tomcat.util.net.TcpWorkerThread.runIt(Unknown Source) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(Unknown Source) at java.lang.Thread.run(Thread.java:484) 2002-03-08 11:20:55 - ErrorHandler: Error loop for R( /AgentGenerator + /servlet/Create + null) error java.lang.IllegalS tateException: Response has already been committed I have tried (and tried, and tried, ...) to find some information on the web, but have yet to find a solution. It seems I can't forward more than once from the same servlet, but I'm not even sure if I'm right about that. If anyone can shed any light on this issue it would be most appreciated. Thanks, Lindsay -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED]
RE: How can I resolve this IllegalStateException: Response has alrea dy been committed problem?
So at what point in this process are you getting this error? I'm not sure I understand the flow of the application, but it seems to be the pretty standard jsp to servlet to jsp flow? In my experiences, I usually get this error when I try to perform a redirect within a jsp that has already started writing out to the response. I don't believe this is your scenario (based on your explanation). Perhaps you are redirecting or forwarding your response to another servlet/jsp and are then trying to manipulate that response? If so, you would need to do all manipulation first, then forward your request on. -Ryan -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Friday, March 08, 2002 8:01 AM To: [EMAIL PROTECTED] Subject: How can I resolve this IllegalStateException: Response has alrea dy been committed problem? [TOMCAT-3.3 JDK 1.3.1 WIN 2000] Hi everyone, I have a webapp that consists of various servlets - each of which is associated with one or more JSPs. The way it works is that someone logs in (by calling a servlet which forwards them to the JSP form). This servlet then processes the input and then (upon successful authorisation) forwards control to another servlet (which then displays another JSP and handles user requests from this JSP). This servlet then processes the user requests and forwards control to the relevant servlet, which then forwards them to a JSP page. My application is working just fine, apart from the fact that I keep getting these annoying IllegalStateExceptions. Here is the full exception: 2002-03-08 11:20:55 - Ctx(/AgentGenerator) : IllegalStateException in R( /AgentGenerator + /servlet/Create + null) - java.lang.IllegalStateException: Response has already been committed at org.apache.tomcat.facade.HttpServletResponseFacade.sendError(Unknown Source) at org.apache.tomcat.facade.HttpServletResponseFacade.sendRedirect(Unknown Source) at zeus.generator.web.controllers.Home.goToAddress(Home.java:163) at zeus.generator.web.controllers.Home.processRequest(Home.java:120) at zeus.generator.web.controllers.Home.doGet(Home.java:131) at javax.servlet.http.HttpServlet.service(HttpServlet.java) at javax.servlet.http.HttpServlet.service(HttpServlet.java) at org.apache.tomcat.facade.ServletHandler.doService(Unknown Source) at org.apache.tomcat.core.Handler.invoke(Unknown Source) at org.apache.tomcat.core.Handler.service(Unknown Source) at org.apache.tomcat.facade.ServletHandler.service(Unknown Source) at org.apache.tomcat.core.ContextManager.internalService(Unknown Source) at org.apache.tomcat.core.ContextManager.service(Unknown Source) at org.apache.tomcat.modules.server.Http10Interceptor.processConnection(Unknown Source) at org.apache.tomcat.util.net.TcpWorkerThread.runIt(Unknown Source) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(Unknown Source) at java.lang.Thread.run(Thread.java:484) 2002-03-08 11:20:55 - ErrorHandler: Error loop for R( /AgentGenerator + /servlet/Create + null) error java.lang.IllegalS tateException: Response has already been committed I have tried (and tried, and tried, ...) to find some information on the web, but have yet to find a solution. It seems I can't forward more than once from the same servlet, but I'm not even sure if I'm right about that. If anyone can shed any light on this issue it would be most appreciated. Thanks, Lindsay -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED] -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED]
RE: How can I resolve this IllegalStateException: Response has a lrea dy been committed problem?
OK here's the sequence of events: [ Note: all forwarding done using RequestDispatcher.forward(req,res) ] 1. User begins by clicking link to Login servlet 2. Login servlet forwards to login.jsp 3. Login.jsp submits request to Login servlet 4. Servlet authorizes user and forwards to Home servlet 5. Home servlet forwards to home.jsp NO EXCEPTIONS YET - EVERYTHING IS OK! 6. User then chooses an action (e.g. create new agent, in my example) from home.jsp and submits request to Home servlet 7. Home servlet processes request and forwards to appropriate servlet (called Create in my example) 8. Create servlet does some stuff and forwards to create.jsp BANG! I GET THIS EXCEPTION (I have included some buildup to this exception): Now in Home servlet - processing request... 2002-03-08 13:19:08 - DecodeInterceptor: Charset from session ISO-8859-1 Now in Create servlet - processing request... Getting list of available types seems to have went OK 2002-03-08 13:19:09 - Ctx(/AgentGenerator) : IllegalStateException in R( /AgentGenerator + /create.jsp + null) - java.la ng.IllegalStateException: Cannot forward because the response has already been committed at org.apache.tomcat.facade.RequestDispatcherImpl.doForward(Unknown Source) at org.apache.tomcat.facade.RequestDispatcherImpl.forward(Unknown Source) at zeus.generator.web.controllers.Home.goToAddress(Home.java:157) at zeus.generator.web.controllers.Home.processRequest(Home.java:120) at zeus.generator.web.controllers.Home.doGet(Home.java:131) at javax.servlet.http.HttpServlet.service(HttpServlet.java) at javax.servlet.http.HttpServlet.service(HttpServlet.java) at org.apache.tomcat.facade.ServletHandler.doService(Unknown Source) at org.apache.tomcat.core.Handler.invoke(Unknown Source) at org.apache.tomcat.core.Handler.service(Unknown Source) at org.apache.tomcat.facade.ServletHandler.service(Unknown Source) at org.apache.tomcat.core.ContextManager.internalService(Unknown Source) at org.apache.tomcat.core.ContextManager.service(Unknown Source) at org.apache.tomcat.modules.server.Http10Interceptor.processConnection(Unknown Source) at org.apache.tomcat.util.net.TcpWorkerThread.runIt(Unknown Source) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(Unknown Source) at java.lang.Thread.run(Thread.java:484) But the page is being displayed OK, and the application continues to function properly. I'd just like to get rid of this exception somehow. Maybe the way I am forwarding so much is not the best way to do things, but it is working. What alternatives are there? Oh, I get the same sort of messages when I substitute requestDispatcher.forward() with response.sendRedirect(). Many thanks if anyone can assist, Cheers Lindsay -Original Message- From: Ryan Daigle [mailto:[EMAIL PROTECTED]] Sent: 08 March 2002 12:58 To: 'Tomcat Users List' Subject:RE: How can I resolve this IllegalStateException: Response has a lrea dy been committed problem? So at what point in this process are you getting this error? I'm not sure I understand the flow of the application, but it seems to be the pretty standard jsp to servlet to jsp flow? In my experiences, I usually get this error when I try to perform a redirect within a jsp that has already started writing out to the response. I don't believe this is your scenario (based on your explanation). Perhaps you are redirecting or forwarding your response to another servlet/jsp and are then trying to manipulate that response? If so, you would need to do all manipulation first, then forward your request on. -Ryan -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Friday, March 08, 2002 8:01 AM To: [EMAIL PROTECTED] Subject: How can I resolve this IllegalStateException: Response has alrea dy been committed problem? [TOMCAT-3.3 JDK 1.3.1 WIN 2000] Hi everyone, I have a webapp that consists of various servlets - each of which is associated with one or more JSPs. The way it works is that someone logs in (by calling a servlet which forwards them to the JSP form). This servlet then processes the input and then (upon successful authorisation) forwards control to another servlet (which then displays another JSP and handles user requests from this JSP). This servlet then processes the user requests and forwards control to the relevant servlet, which then forwards them to a JSP page. My application is working just fine, apart from the fact that I keep getting these annoying IllegalStateExceptions. Here is the full exception: 2002-03-08 11:20:55 - Ctx(/AgentGenerator) : IllegalStateException in R( /AgentGenerator + /servlet/Create + null) - java.lang.IllegalStateException: Response has already been committed at org.apache.tomcat.facade.HttpServletResponseFacade.sendError(Unknown Source
RE: How can I resolve this IllegalStateException: Response has a lrea dy been committed problem?
Are you sure there isn't something in create.jsp that is trying to manipulate the response? I have found that trying to do a jsp:include... after manipulating the session can cause this exception. Is this a possibility? Perhaps you could send the relevant source of create.jsp and the Create servlet? -Ryan -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Friday, March 08, 2002 8:26 AM To: [EMAIL PROTECTED] Subject: RE: How can I resolve this IllegalStateException: Response has a lrea dy been committed problem? OK here's the sequence of events: [ Note: all forwarding done using RequestDispatcher.forward(req,res) ] 1. User begins by clicking link to Login servlet 2. Login servlet forwards to login.jsp 3. Login.jsp submits request to Login servlet 4. Servlet authorizes user and forwards to Home servlet 5. Home servlet forwards to home.jsp NO EXCEPTIONS YET - EVERYTHING IS OK! 6. User then chooses an action (e.g. create new agent, in my example) from home.jsp and submits request to Home servlet 7. Home servlet processes request and forwards to appropriate servlet (called Create in my example) 8. Create servlet does some stuff and forwards to create.jsp BANG! I GET THIS EXCEPTION (I have included some buildup to this exception): Now in Home servlet - processing request... 2002-03-08 13:19:08 - DecodeInterceptor: Charset from session ISO-8859-1 Now in Create servlet - processing request... Getting list of available types seems to have went OK 2002-03-08 13:19:09 - Ctx(/AgentGenerator) : IllegalStateException in R( /AgentGenerator + /create.jsp + null) - java.la ng.IllegalStateException: Cannot forward because the response has already been committed at org.apache.tomcat.facade.RequestDispatcherImpl.doForward(Unknown Source) at org.apache.tomcat.facade.RequestDispatcherImpl.forward(Unknown Source) at zeus.generator.web.controllers.Home.goToAddress(Home.java:157) at zeus.generator.web.controllers.Home.processRequest(Home.java:120) at zeus.generator.web.controllers.Home.doGet(Home.java:131) at javax.servlet.http.HttpServlet.service(HttpServlet.java) at javax.servlet.http.HttpServlet.service(HttpServlet.java) at org.apache.tomcat.facade.ServletHandler.doService(Unknown Source) at org.apache.tomcat.core.Handler.invoke(Unknown Source) at org.apache.tomcat.core.Handler.service(Unknown Source) at org.apache.tomcat.facade.ServletHandler.service(Unknown Source) at org.apache.tomcat.core.ContextManager.internalService(Unknown Source) at org.apache.tomcat.core.ContextManager.service(Unknown Source) at org.apache.tomcat.modules.server.Http10Interceptor.processConnection(Unknown Source) at org.apache.tomcat.util.net.TcpWorkerThread.runIt(Unknown Source) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(Unknown Source) at java.lang.Thread.run(Thread.java:484) But the page is being displayed OK, and the application continues to function properly. I'd just like to get rid of this exception somehow. Maybe the way I am forwarding so much is not the best way to do things, but it is working. What alternatives are there? Oh, I get the same sort of messages when I substitute requestDispatcher.forward() with response.sendRedirect(). Many thanks if anyone can assist, Cheers Lindsay -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED]
RE: How can I resolve this IllegalStateException: Response has a lrea dy been committed problem?
The exception seems to be occurring because the Home servlet forwards more than once (to different locations) - first to home.jsp, then later to the Create servlet. It is definitely the fact that it is forwarding to more than one place, that is causing the problem. I know this because if I call the Login servlet and fail the login authorization - this servlet consequently forwards to login.jsp more than once (first - to display the fresh login page, and second - to prompt user to try again). This however does not give me an exception. Given that my Home servlet is like the central servlet, it needs to be capable of forwarding to a variety of places, depending on the activity selected by the user. Ryan - I have looked at create.jsp and, as far as my little mind can see, it does not play with the response object at all. All it does is get a few session attributes and fit them into the page using %= blablabla %. Could that be a problem? This problem is not isolated to the Create example. There are other activities the user can choose which all follow exactly the same forwarding mechanism (except to different servlets), and these give exactly the same exception. Lindsay -Original Message- From: Ryan Daigle [mailto:[EMAIL PROTECTED]] Sent: 08 March 2002 13:25 To: 'Tomcat Users List' Subject:RE: How can I resolve this IllegalStateException: Response has a lrea dy been committed problem? Are you sure there isn't something in create.jsp that is trying to manipulate the response? I have found that trying to do a jsp:include... after manipulating the session can cause this exception. Is this a possibility? Perhaps you could send the relevant source of create.jsp and the Create servlet? -Ryan -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Friday, March 08, 2002 8:26 AM To: [EMAIL PROTECTED] Subject: RE: How can I resolve this IllegalStateException: Response has a lrea dy been committed problem? OK here's the sequence of events: [ Note: all forwarding done using RequestDispatcher.forward(req,res) ] 1. User begins by clicking link to Login servlet 2. Login servlet forwards to login.jsp 3. Login.jsp submits request to Login servlet 4. Servlet authorizes user and forwards to Home servlet 5. Home servlet forwards to home.jsp NO EXCEPTIONS YET - EVERYTHING IS OK! 6. User then chooses an action (e.g. create new agent, in my example) from home.jsp and submits request to Home servlet 7. Home servlet processes request and forwards to appropriate servlet (called Create in my example) 8. Create servlet does some stuff and forwards to create.jsp BANG! I GET THIS EXCEPTION (I have included some buildup to this exception): Now in Home servlet - processing request... 2002-03-08 13:19:08 - DecodeInterceptor: Charset from session ISO-8859-1 Now in Create servlet - processing request... Getting list of available types seems to have went OK 2002-03-08 13:19:09 - Ctx(/AgentGenerator) : IllegalStateException in R( /AgentGenerator + /create.jsp + null) - java.la ng.IllegalStateException: Cannot forward because the response has already been committed at org.apache.tomcat.facade.RequestDispatcherImpl.doForward(Unknown Source) at org.apache.tomcat.facade.RequestDispatcherImpl.forward(Unknown Source) at zeus.generator.web.controllers.Home.goToAddress(Home.java:157) at zeus.generator.web.controllers.Home.processRequest(Home.java:120) at zeus.generator.web.controllers.Home.doGet(Home.java:131) at javax.servlet.http.HttpServlet.service(HttpServlet.java) at javax.servlet.http.HttpServlet.service(HttpServlet.java) at org.apache.tomcat.facade.ServletHandler.doService(Unknown Source) at org.apache.tomcat.core.Handler.invoke(Unknown Source) at org.apache.tomcat.core.Handler.service(Unknown Source) at org.apache.tomcat.facade.ServletHandler.service(Unknown Source) at org.apache.tomcat.core.ContextManager.internalService(Unknown Source) at org.apache.tomcat.core.ContextManager.service(Unknown Source) at org.apache.tomcat.modules.server.Http10Interceptor.processConnection(Unknown Source) at org.apache.tomcat.util.net.TcpWorkerThread.runIt(Unknown Source) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(Unknown Source) at java.lang.Thread.run(Thread.java:484) But the page is being displayed OK, and the application continues to function properly. I'd just like to get rid of this exception somehow. Maybe the way I am forwarding so much is not the best way to do things, but it is working. What alternatives are there? Oh, I get the same sort of messages when I substitute requestDispatcher.forward() with response.sendRedirect(). Many thanks if anyone can assist, Cheers Lindsay -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED
RE: How can I resolve this IllegalStateException: Response has a lrea dy been committed problem?
Is it possible to change the Create servlet to a simple class that accepts the request as a parameter? Since it does not manipulate the response object, there is no need to pass it. Also, you can then call Create using a regular method invocation, rather than using forward. It may require some work, but you could eliminate the double forward issue. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Friday, March 08, 2002 8:45 AM To: [EMAIL PROTECTED] Subject: RE: How can I resolve this IllegalStateException: Response has a lrea dy been committed problem? The exception seems to be occurring because the Home servlet forwards more than once (to different locations) - first to home.jsp, then later to the Create servlet. It is definitely the fact that it is forwarding to more than one place, that is causing the problem. I know this because if I call the Login servlet and fail the login authorization - this servlet consequently forwards to login.jsp more than once (first - to display the fresh login page, and second - to prompt user to try again). This however does not give me an exception. Given that my Home servlet is like the central servlet, it needs to be capable of forwarding to a variety of places, depending on the activity selected by the user. Ryan - I have looked at create.jsp and, as far as my little mind can see, it does not play with the response object at all. All it does is get a few session attributes and fit them into the page using %= blablabla %. Could that be a problem? This problem is not isolated to the Create example. There are other activities the user can choose which all follow exactly the same forwarding mechanism (except to different servlets), and these give exactly the same exception. Lindsay -Original Message- From: Ryan Daigle [mailto:[EMAIL PROTECTED]] Sent: 08 March 2002 13:25 To: 'Tomcat Users List' Subject:RE: How can I resolve this IllegalStateException: Response has a lrea dy been committed problem? Are you sure there isn't something in create.jsp that is trying to manipulate the response? I have found that trying to do a jsp:include... after manipulating the session can cause this exception. Is this a possibility? Perhaps you could send the relevant source of create.jsp and the Create servlet? -Ryan -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Friday, March 08, 2002 8:26 AM To: [EMAIL PROTECTED] Subject: RE: How can I resolve this IllegalStateException: Response has a lrea dy been committed problem? OK here's the sequence of events: [ Note: all forwarding done using RequestDispatcher.forward(req,res) ] 1. User begins by clicking link to Login servlet 2. Login servlet forwards to login.jsp 3. Login.jsp submits request to Login servlet 4. Servlet authorizes user and forwards to Home servlet 5. Home servlet forwards to home.jsp NO EXCEPTIONS YET - EVERYTHING IS OK! 6. User then chooses an action (e.g. create new agent, in my example) from home.jsp and submits request to Home servlet 7. Home servlet processes request and forwards to appropriate servlet (called Create in my example) 8. Create servlet does some stuff and forwards to create.jsp BANG! I GET THIS EXCEPTION (I have included some buildup to this exception): Now in Home servlet - processing request... 2002-03-08 13:19:08 - DecodeInterceptor: Charset from session ISO-8859-1 Now in Create servlet - processing request... Getting list of available types seems to have went OK 2002-03-08 13:19:09 - Ctx(/AgentGenerator) : IllegalStateException in R( /AgentGenerator + /create.jsp + null) - java.la ng.IllegalStateException: Cannot forward because the response has already been committed at org.apache.tomcat.facade.RequestDispatcherImpl.doForward(Unknown Source) at org.apache.tomcat.facade.RequestDispatcherImpl.forward(Unknown Source) at zeus.generator.web.controllers.Home.goToAddress(Home.java:157) at zeus.generator.web.controllers.Home.processRequest(Home.java:120) at zeus.generator.web.controllers.Home.doGet(Home.java:131) at javax.servlet.http.HttpServlet.service(HttpServlet.java) at javax.servlet.http.HttpServlet.service(HttpServlet.java) at org.apache.tomcat.facade.ServletHandler.doService(Unknown Source) at org.apache.tomcat.core.Handler.invoke(Unknown Source) at org.apache.tomcat.core.Handler.service(Unknown Source) at org.apache.tomcat.facade.ServletHandler.service(Unknown Source) at org.apache.tomcat.core.ContextManager.internalService(Unknown Source) at org.apache.tomcat.core.ContextManager.service(Unknown Source) at org.apache.tomcat.modules.server.Http10Interceptor.processConnection(Unknown Source) at org.apache.tomcat.util.net.TcpWorkerThread.runIt(Unknown Source) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(Unknown Source
RE: How can I resolve this IllegalStateException: Response has a lrea dy been committed problem?
My impression of this situation was that at runtime there was only one request forward happening. The Home servlet may have more than one forward call, but at runtime only one gets executed (per request), right? So within each servlet only one forward happens, but a string of servlets has more than one forward total. Is this correct? Ryan Daigle Java Developer Health Decisions, Inc. 1512 E. Franklin St, Suite 200 Chapel Hill, NC 27514 (919) 967-2399 ext: 251 [EMAIL PROTECTED] http://www.healthdec.com -Original Message- From: Wagoner, Mark [mailto:[EMAIL PROTECTED]] Sent: Friday, March 08, 2002 8:58 AM To: 'Tomcat Users List' Subject: RE: How can I resolve this IllegalStateException: Response has a lrea dy been committed problem? Is it possible to change the Create servlet to a simple class that accepts the request as a parameter? Since it does not manipulate the response object, there is no need to pass it. Also, you can then call Create using a regular method invocation, rather than using forward. It may require some work, but you could eliminate the double forward issue. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Friday, March 08, 2002 8:45 AM To: [EMAIL PROTECTED] Subject: RE: How can I resolve this IllegalStateException: Response has a lrea dy been committed problem? The exception seems to be occurring because the Home servlet forwards more than once (to different locations) - first to home.jsp, then later to the Create servlet. It is definitely the fact that it is forwarding to more than one place, that is causing the problem. I know this because if I call the Login servlet and fail the login authorization - this servlet consequently forwards to login.jsp more than once (first - to display the fresh login page, and second - to prompt user to try again). This however does not give me an exception. Given that my Home servlet is like the central servlet, it needs to be capable of forwarding to a variety of places, depending on the activity selected by the user. Ryan - I have looked at create.jsp and, as far as my little mind can see, it does not play with the response object at all. All it does is get a few session attributes and fit them into the page using %= blablabla %. Could that be a problem? This problem is not isolated to the Create example. There are other activities the user can choose which all follow exactly the same forwarding mechanism (except to different servlets), and these give exactly the same exception. Lindsay -Original Message- From: Ryan Daigle [mailto:[EMAIL PROTECTED]] Sent: 08 March 2002 13:25 To: 'Tomcat Users List' Subject:RE: How can I resolve this IllegalStateException: Response has a lrea dy been committed problem? Are you sure there isn't something in create.jsp that is trying to manipulate the response? I have found that trying to do a jsp:include... after manipulating the session can cause this exception. Is this a possibility? Perhaps you could send the relevant source of create.jsp and the Create servlet? -Ryan -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Friday, March 08, 2002 8:26 AM To: [EMAIL PROTECTED] Subject: RE: How can I resolve this IllegalStateException: Response has a lrea dy been committed problem? OK here's the sequence of events: [ Note: all forwarding done using RequestDispatcher.forward(req,res) ] 1. User begins by clicking link to Login servlet 2. Login servlet forwards to login.jsp 3. Login.jsp submits request to Login servlet 4. Servlet authorizes user and forwards to Home servlet 5. Home servlet forwards to home.jsp NO EXCEPTIONS YET - EVERYTHING IS OK! 6. User then chooses an action (e.g. create new agent, in my example) from home.jsp and submits request to Home servlet 7. Home servlet processes request and forwards to appropriate servlet (called Create in my example) 8. Create servlet does some stuff and forwards to create.jsp BANG! I GET THIS EXCEPTION (I have included some buildup to this exception): Now in Home servlet - processing request... 2002-03-08 13:19:08 - DecodeInterceptor: Charset from session ISO-8859-1 Now in Create servlet - processing request... Getting list of available types seems to have went OK 2002-03-08 13:19:09 - Ctx(/AgentGenerator) : IllegalStateException in R( /AgentGenerator + /create.jsp + null) - java.la ng.IllegalStateException: Cannot forward because the response has already been committed at org.apache.tomcat.facade.RequestDispatcherImpl.doForward(Unknown Source) at org.apache.tomcat.facade.RequestDispatcherImpl.forward(Unknown Source) at zeus.generator.web.controllers.Home.goToAddress(Home.java:157) at zeus.generator.web.controllers.Home.processRequest(Home.java:120) at zeus.generator.web.controllers.Home.doGet(Home.java:131) at javax.servlet.http.HttpServlet.service(HttpServlet.java
RE: How can I resolve this IllegalStateException: Response has a lrea dy been committed problem?
OK I am interested in all such solutions. But if the Create servlet is not a servlet, then how can it get/set session attributes, forward to the JSP and also process requests from the JSP. Surely there must be a way for me to have multiple servlets? But how can I fit them all together so as to avoid this exception. -Original Message- From: Wagoner, Mark [mailto:[EMAIL PROTECTED]] Sent: 08 March 2002 13:58 To: 'Tomcat Users List' Subject:RE: How can I resolve this IllegalStateException: Response has a lrea dy been committed problem? Is it possible to change the Create servlet to a simple class that accepts the request as a parameter? Since it does not manipulate the response object, there is no need to pass it. Also, you can then call Create using a regular method invocation, rather than using forward. It may require some work, but you could eliminate the double forward issue. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Friday, March 08, 2002 8:45 AM To: [EMAIL PROTECTED] Subject: RE: How can I resolve this IllegalStateException: Response has a lrea dy been committed problem? The exception seems to be occurring because the Home servlet forwards more than once (to different locations) - first to home.jsp, then later to the Create servlet. It is definitely the fact that it is forwarding to more than one place, that is causing the problem. I know this because if I call the Login servlet and fail the login authorization - this servlet consequently forwards to login.jsp more than once (first - to display the fresh login page, and second - to prompt user to try again). This however does not give me an exception. Given that my Home servlet is like the central servlet, it needs to be capable of forwarding to a variety of places, depending on the activity selected by the user. Ryan - I have looked at create.jsp and, as far as my little mind can see, it does not play with the response object at all. All it does is get a few session attributes and fit them into the page using %= blablabla %. Could that be a problem? This problem is not isolated to the Create example. There are other activities the user can choose which all follow exactly the same forwarding mechanism (except to different servlets), and these give exactly the same exception. Lindsay -Original Message- From: Ryan Daigle [mailto:[EMAIL PROTECTED]] Sent: 08 March 2002 13:25 To: 'Tomcat Users List' Subject:RE: How can I resolve this IllegalStateException: Response has a lrea dy been committed problem? Are you sure there isn't something in create.jsp that is trying to manipulate the response? I have found that trying to do a jsp:include... after manipulating the session can cause this exception. Is this a possibility? Perhaps you could send the relevant source of create.jsp and the Create servlet? -Ryan -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Friday, March 08, 2002 8:26 AM To: [EMAIL PROTECTED] Subject: RE: How can I resolve this IllegalStateException: Response has a lrea dy been committed problem? OK here's the sequence of events: [ Note: all forwarding done using RequestDispatcher.forward(req,res) ] 1. User begins by clicking link to Login servlet 2. Login servlet forwards to login.jsp 3. Login.jsp submits request to Login servlet 4. Servlet authorizes user and forwards to Home servlet 5. Home servlet forwards to home.jsp NO EXCEPTIONS YET - EVERYTHING IS OK! 6. User then chooses an action (e.g. create new agent, in my example) from home.jsp and submits request to Home servlet 7. Home servlet processes request and forwards to appropriate servlet (called Create in my example) 8. Create servlet does some stuff and forwards to create.jsp BANG! I GET THIS EXCEPTION (I have included some buildup to this exception): Now in Home servlet - processing request... 2002-03-08 13:19:08 - DecodeInterceptor: Charset from session ISO-8859-1 Now in Create servlet - processing request... Getting list of available types seems to have went OK 2002-03-08 13:19:09 - Ctx(/AgentGenerator) : IllegalStateException in R( /AgentGenerator + /create.jsp + null) - java.la ng.IllegalStateException: Cannot forward because the response has already been committed at org.apache.tomcat.facade.RequestDispatcherImpl.doForward(Unknown Source) at org.apache.tomcat.facade.RequestDispatcherImpl.forward(Unknown Source) at zeus.generator.web.controllers.Home.goToAddress(Home.java:157) at zeus.generator.web.controllers.Home.processRequest(Home.java:120) at zeus.generator.web.controllers.Home.doGet(Home.java:131) at javax.servlet.http.HttpServlet.service(HttpServlet.java) at javax.servlet.http.HttpServlet.service(HttpServlet.java) at org.apache.tomcat.facade.ServletHandler.doService(Unknown Source) at org.apache.tomcat.core.Handler.invoke(Unknown Source
RE: How can I resolve this IllegalStateException: Response has a lrea dybeen committed problem?
Are you sending back any response or setting any session info in Create servlet before forwarding to create.jsp? Thanks. RS [EMAIL PROTECTED] on 03/08/2002 07:25:48 AM Please respond to Tomcat Users List [EMAIL PROTECTED] To: [EMAIL PROTECTED] cc: Subject: RE: How can I resolve this IllegalStateException: Response has a lrea dy been committed problem? OK here's the sequence of events: [ Note: all forwarding done using RequestDispatcher.forward(req,res) ] 1. User begins by clicking link to Login servlet 2. Login servlet forwards to login.jsp 3. Login.jsp submits request to Login servlet 4. Servlet authorizes user and forwards to Home servlet 5. Home servlet forwards to home.jsp NO EXCEPTIONS YET - EVERYTHING IS OK! 6. User then chooses an action (e.g. create new agent, in my example) from home.jsp and submits request to Home servlet 7. Home servlet processes request and forwards to appropriate servlet (called Create in my example) 8. Create servlet does some stuff and forwards to create.jsp BANG! I GET THIS EXCEPTION (I have included some buildup to this exception): Now in Home servlet - processing request... 2002-03-08 13:19:08 - DecodeInterceptor: Charset from session ISO-8859-1 Now in Create servlet - processing request... Getting list of available types seems to have went OK 2002-03-08 13:19:09 - Ctx(/AgentGenerator) : IllegalStateException in R( /AgentGenerator + /create.jsp + null) - java.la ng.IllegalStateException: Cannot forward because the response has already been committed at org.apache.tomcat.facade.RequestDispatcherImpl.doForward(Unknown Source) at org.apache.tomcat.facade.RequestDispatcherImpl.forward(Unknown Source) at zeus.generator.web.controllers.Home.goToAddress(Home.java:157) at zeus.generator.web.controllers.Home.processRequest(Home.java:120) at zeus.generator.web.controllers.Home.doGet(Home.java:131) at javax.servlet.http.HttpServlet.service(HttpServlet.java) at javax.servlet.http.HttpServlet.service(HttpServlet.java) at org.apache.tomcat.facade.ServletHandler.doService(Unknown Source) at org.apache.tomcat.core.Handler.invoke(Unknown Source) at org.apache.tomcat.core.Handler.service(Unknown Source) at org.apache.tomcat.facade.ServletHandler.service(Unknown Source) at org.apache.tomcat.core.ContextManager.internalService(Unknown Source) at org.apache.tomcat.core.ContextManager.service(Unknown Source) at org.apache.tomcat.modules.server.Http10Interceptor.processConnection(Unknown Source) at org.apache.tomcat.util.net.TcpWorkerThread.runIt(Unknown Source) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(Unknown Source) at java.lang.Thread.run(Thread.java:484) But the page is being displayed OK, and the application continues to function properly. I'd just like to get rid of this exception somehow. Maybe the way I am forwarding so much is not the best way to do things, but it is working. What alternatives are there? Oh, I get the same sort of messages when I substitute requestDispatcher.forward() with response.sendRedirect(). Many thanks if anyone can assist, Cheers Lindsay -Original Message- From: Ryan Daigle [mailto:[EMAIL PROTECTED]] Sent: 08 March 2002 12:58 To:'Tomcat Users List' Subject:RE: How can I resolve this IllegalStateException: Response has a lrea dy been committed problem? So at what point in this process are you getting this error? I'm not sure I understand the flow of the application, but it seems to be the pretty standard jsp to servlet to jsp flow? In my experiences, I usually get this error when I try to perform a redirect within a jsp that has already started writing out to the response. I don't believe this is your scenario (based on your explanation). Perhaps you are redirecting or forwarding your response to another servlet/jsp and are then trying to manipulate that response? If so, you would need to do all manipulation first, then forward your request on. -Ryan -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Friday, March 08, 2002 8:01 AM To: [EMAIL PROTECTED] Subject: How can I resolve this IllegalStateException: Response has alrea dy been committed problem? [TOMCAT-3.3 JDK 1.3.1 WIN 2000] Hi everyone, I have a webapp that consists of various servlets - each of which is associated with one or more JSPs. The way it works is that someone logs in (by calling a servlet which forwards them to the JSP form). This servlet then processes the input and then (upon successful authorisation) forwards control to another servlet (which then displays another JSP and handles user requests from this JSP). This servlet then processes the user requests and forwards control to the relevant servlet, which then forwards them to a JSP page. My application is working just fine, apart from
RE: How can I resolve this IllegalStateException: Response has a lrea dy been committed problem?
Yep that's right. Only one forward getting done per request. The main controller servlet (e.g. Home) forwards to another more specific controller servlet (e.g. Create), which then forwards to a JSP. Then later, that servlet forwards back (?? Maybe this isn't wise?) to the main controller servlet. A whole lot of forwarding going on. -Original Message- From: Ryan Daigle [mailto:[EMAIL PROTECTED]] Sent: 08 March 2002 13:56 To: 'Tomcat Users List' Subject:RE: How can I resolve this IllegalStateException: Response has a lrea dy been committed problem? My impression of this situation was that at runtime there was only one request forward happening. The Home servlet may have more than one forward call, but at runtime only one gets executed (per request), right? So within each servlet only one forward happens, but a string of servlets has more than one forward total. Is this correct? Ryan Daigle Java Developer Health Decisions, Inc. 1512 E. Franklin St, Suite 200 Chapel Hill, NC 27514 (919) 967-2399 ext: 251 [EMAIL PROTECTED] http://www.healthdec.com -Original Message- From: Wagoner, Mark [mailto:[EMAIL PROTECTED]] Sent: Friday, March 08, 2002 8:58 AM To: 'Tomcat Users List' Subject: RE: How can I resolve this IllegalStateException: Response has a lrea dy been committed problem? Is it possible to change the Create servlet to a simple class that accepts the request as a parameter? Since it does not manipulate the response object, there is no need to pass it. Also, you can then call Create using a regular method invocation, rather than using forward. It may require some work, but you could eliminate the double forward issue. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Friday, March 08, 2002 8:45 AM To: [EMAIL PROTECTED] Subject: RE: How can I resolve this IllegalStateException: Response has a lrea dy been committed problem? The exception seems to be occurring because the Home servlet forwards more than once (to different locations) - first to home.jsp, then later to the Create servlet. It is definitely the fact that it is forwarding to more than one place, that is causing the problem. I know this because if I call the Login servlet and fail the login authorization - this servlet consequently forwards to login.jsp more than once (first - to display the fresh login page, and second - to prompt user to try again). This however does not give me an exception. Given that my Home servlet is like the central servlet, it needs to be capable of forwarding to a variety of places, depending on the activity selected by the user. Ryan - I have looked at create.jsp and, as far as my little mind can see, it does not play with the response object at all. All it does is get a few session attributes and fit them into the page using %= blablabla %. Could that be a problem? This problem is not isolated to the Create example. There are other activities the user can choose which all follow exactly the same forwarding mechanism (except to different servlets), and these give exactly the same exception. Lindsay -Original Message- From: Ryan Daigle [mailto:[EMAIL PROTECTED]] Sent: 08 March 2002 13:25 To: 'Tomcat Users List' Subject:RE: How can I resolve this IllegalStateException: Response has a lrea dy been committed problem? Are you sure there isn't something in create.jsp that is trying to manipulate the response? I have found that trying to do a jsp:include... after manipulating the session can cause this exception. Is this a possibility? Perhaps you could send the relevant source of create.jsp and the Create servlet? -Ryan -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Friday, March 08, 2002 8:26 AM To: [EMAIL PROTECTED] Subject: RE: How can I resolve this IllegalStateException: Response has a lrea dy been committed problem? OK here's the sequence of events: [ Note: all forwarding done using RequestDispatcher.forward(req,res) ] 1. User begins by clicking link to Login servlet 2. Login servlet forwards to login.jsp 3. Login.jsp submits request to Login servlet 4. Servlet authorizes user and forwards to Home servlet 5. Home servlet forwards to home.jsp NO EXCEPTIONS YET - EVERYTHING IS OK! 6. User then chooses an action (e.g. create new agent, in my example) from home.jsp and submits request to Home servlet 7. Home servlet processes request and forwards to appropriate servlet (called Create in my example) 8. Create servlet does some stuff and forwards to create.jsp BANG! I GET THIS EXCEPTION (I have included some buildup to this exception): Now in Home servlet - processing request... 2002-03-08 13:19:08 - DecodeInterceptor: Charset from session ISO-8859-1 Now in Create servlet - processing request... Getting list of available types seems to have went OK 2002-03-08 13:19:09 - Ctx(/AgentGenerator) : IllegalStateException in R( /AgentGenerator
RE: How can I resolve this IllegalStateException: Response has a lrea dy been committed problem?
You don't need to forward back to the original servlet. Each call is done as a stack, so when the JSP returns, control comes back to the Create servlet. When the Create servlet returns, control comes back to the Home servlet. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Friday, March 08, 2002 9:27 AM To: [EMAIL PROTECTED] Subject: RE: How can I resolve this IllegalStateException: Response has a lrea dy been committed problem? Yep that's right. Only one forward getting done per request. The main controller servlet (e.g. Home) forwards to another more specific controller servlet (e.g. Create), which then forwards to a JSP. Then later, that servlet forwards back (?? Maybe this isn't wise?) to the main controller servlet. A whole lot of forwarding going on. -Original Message- From: Ryan Daigle [mailto:[EMAIL PROTECTED]] Sent: 08 March 2002 13:56 To: 'Tomcat Users List' Subject:RE: How can I resolve this IllegalStateException: Response has a lrea dy been committed problem? My impression of this situation was that at runtime there was only one request forward happening. The Home servlet may have more than one forward call, but at runtime only one gets executed (per request), right? So within each servlet only one forward happens, but a string of servlets has more than one forward total. Is this correct? Ryan Daigle Java Developer Health Decisions, Inc. 1512 E. Franklin St, Suite 200 Chapel Hill, NC 27514 (919) 967-2399 ext: 251 [EMAIL PROTECTED] http://www.healthdec.com -Original Message- From: Wagoner, Mark [mailto:[EMAIL PROTECTED]] Sent: Friday, March 08, 2002 8:58 AM To: 'Tomcat Users List' Subject: RE: How can I resolve this IllegalStateException: Response has a lrea dy been committed problem? Is it possible to change the Create servlet to a simple class that accepts the request as a parameter? Since it does not manipulate the response object, there is no need to pass it. Also, you can then call Create using a regular method invocation, rather than using forward. It may require some work, but you could eliminate the double forward issue. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Friday, March 08, 2002 8:45 AM To: [EMAIL PROTECTED] Subject: RE: How can I resolve this IllegalStateException: Response has a lrea dy been committed problem? The exception seems to be occurring because the Home servlet forwards more than once (to different locations) - first to home.jsp, then later to the Create servlet. It is definitely the fact that it is forwarding to more than one place, that is causing the problem. I know this because if I call the Login servlet and fail the login authorization - this servlet consequently forwards to login.jsp more than once (first - to display the fresh login page, and second - to prompt user to try again). This however does not give me an exception. Given that my Home servlet is like the central servlet, it needs to be capable of forwarding to a variety of places, depending on the activity selected by the user. Ryan - I have looked at create.jsp and, as far as my little mind can see, it does not play with the response object at all. All it does is get a few session attributes and fit them into the page using %= blablabla %. Could that be a problem? This problem is not isolated to the Create example. There are other activities the user can choose which all follow exactly the same forwarding mechanism (except to different servlets), and these give exactly the same exception. Lindsay -Original Message- From: Ryan Daigle [mailto:[EMAIL PROTECTED]] Sent: 08 March 2002 13:25 To: 'Tomcat Users List' Subject:RE: How can I resolve this IllegalStateException: Response has a lrea dy been committed problem? Are you sure there isn't something in create.jsp that is trying to manipulate the response? I have found that trying to do a jsp:include... after manipulating the session can cause this exception. Is this a possibility? Perhaps you could send the relevant source of create.jsp and the Create servlet? -Ryan -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Friday, March 08, 2002 8:26 AM To: [EMAIL PROTECTED] Subject: RE: How can I resolve this IllegalStateException: Response has a lrea dy been committed problem? OK here's the sequence of events: [ Note: all forwarding done using RequestDispatcher.forward(req,res) ] 1. User begins by clicking link to Login servlet 2. Login servlet forwards to login.jsp 3. Login.jsp submits request to Login servlet 4. Servlet authorizes user and forwards to Home servlet 5. Home servlet forwards to home.jsp NO EXCEPTIONS YET - EVERYTHING IS OK! 6. User then chooses an action (e.g. create new agent, in my example) from home.jsp and submits request to Home servlet 7. Home servlet processes request and forwards to appropriate servlet (called Create
RE: How can I resolve this IllegalStateException: Response has a lrea dy been committed problem?
Don't think JSP is failing. It's quite a simple JSP and has been looked at exhaustively! Yes, I am setting session attributes in Create servlet, for use by create.jsp. I am only using the session object and the request throughout my application. The only time I ever knew I was using the response object was when I used response.sendRedirect(), but I don't use this anymore. I use the RequestDispatcher. There are no jsp:include or jsp:forward tags being used anywhere, and my servlets do not contribute anything to the response (apart from forwarding it around). Mark - your words of wisdom interest me. I thought that... when I invoke requestDispatcher.forward(), then control never returns (to the line following this invocation). So how do I go about returning to the Home servlet from the Create servlet. Surely I need to forward, because the session has changed? I have a lot to learn here I think, but I feel I'm getting closer to the holy grail - getting rid of this exception! -Original Message- From: Attila Szegedi [mailto:[EMAIL PROTECTED]] Sent: 08 March 2002 13:56 To: Tomcat Users List Subject:Re: How can I resolve this IllegalStateException: Response has a lrea dy been committed problem? I guess you JSP is failing with an uncaught exception. At that point, Tomcat would try to send a 500 Internal Server Error response code, but it can't since a 200 OK status code has already been sent (that is, the output committed) to the client. -- Attila Szegedi home: http://www.szegedi.org - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: 2002. március 8. 14:45 Subject: RE: How can I resolve this IllegalStateException: Response has a lrea dy been committed problem? The exception seems to be occurring because the Home servlet forwards more than once (to different locations) - first to home.jsp, then later to the Create servlet. It is definitely the fact that it is forwarding to more than one place, that is causing the problem. I know this because if I call the Login servlet and fail the login authorization - this servlet consequently forwards to login.jsp more than once (first - to display the fresh login page, and second - to prompt user to try again). This however does not give me an exception. Given that my Home servlet is like the central servlet, it needs to be capable of forwarding to a variety of places, depending on the activity selected by the user. Ryan - I have looked at create.jsp and, as far as my little mind can see, it does not play with the response object at all. All it does is get a few session attributes and fit them into the page using %= blablabla %. Could that be a problem? This problem is not isolated to the Create example. There are other activities the user can choose which all follow exactly the same forwarding mechanism (except to different servlets), and these give exactly the same exception. Lindsay -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED] -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED]
RE: How can I resolve this IllegalStateException: Response has a lrea dy been committed problem?
Actually, the way forward works came as a surprise to me as well. And I only figured it out after a few days of testing and head-scratching. :) Since the session is held in the request object, changes made to it should be available to the original Home servlet by calling request.getSession after the forward call returns. Obviously I'm not real familiar with what you are trying to do, but there may be a way you can eliminate the last forward back to the home servlet. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Friday, March 08, 2002 9:44 AM To: [EMAIL PROTECTED] Subject: RE: How can I resolve this IllegalStateException: Response has a lrea dy been committed problem? Don't think JSP is failing. It's quite a simple JSP and has been looked at exhaustively! Yes, I am setting session attributes in Create servlet, for use by create.jsp. I am only using the session object and the request throughout my application. The only time I ever knew I was using the response object was when I used response.sendRedirect(), but I don't use this anymore. I use the RequestDispatcher. There are no jsp:include or jsp:forward tags being used anywhere, and my servlets do not contribute anything to the response (apart from forwarding it around). Mark - your words of wisdom interest me. I thought that... when I invoke requestDispatcher.forward(), then control never returns (to the line following this invocation). So how do I go about returning to the Home servlet from the Create servlet. Surely I need to forward, because the session has changed? I have a lot to learn here I think, but I feel I'm getting closer to the holy grail - getting rid of this exception! -Original Message- From: Attila Szegedi [mailto:[EMAIL PROTECTED]] Sent: 08 March 2002 13:56 To: Tomcat Users List Subject:Re: How can I resolve this IllegalStateException: Response has a lrea dy been committed problem? I guess you JSP is failing with an uncaught exception. At that point, Tomcat would try to send a 500 Internal Server Error response code, but it can't since a 200 OK status code has already been sent (that is, the output committed) to the client. -- Attila Szegedi home: http://www.szegedi.org - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: 2002. március 8. 14:45 Subject: RE: How can I resolve this IllegalStateException: Response has a lrea dy been committed problem? The exception seems to be occurring because the Home servlet forwards more than once (to different locations) - first to home.jsp, then later to the Create servlet. It is definitely the fact that it is forwarding to more than one place, that is causing the problem. I know this because if I call the Login servlet and fail the login authorization - this servlet consequently forwards to login.jsp more than once (first - to display the fresh login page, and second - to prompt user to try again). This however does not give me an exception. Given that my Home servlet is like the central servlet, it needs to be capable of forwarding to a variety of places, depending on the activity selected by the user. Ryan - I have looked at create.jsp and, as far as my little mind can see, it does not play with the response object at all. All it does is get a few session attributes and fit them into the page using %= blablabla %. Could that be a problem? This problem is not isolated to the Create example. There are other activities the user can choose which all follow exactly the same forwarding mechanism (except to different servlets), and these give exactly the same exception. Lindsay -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED] -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED] -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED]
RE: How can I resolve this IllegalStateException: Response has a lrea dy been committed problem?
OK. I never knew the forward call actually returned - ever. I will experiment with this. I'm nearly ready to go away and stop pestering you all, but one more question... Say the Home servlet gets the session object from the request. It later forwards the request to the Create servlet, which essentially modifies the session. Then, when the forward call returns, will the Home servlet's session object be the old one or the updated one? Or will it have to do request.getSession() all over again in order to get latest session. Cheers, Lindsay -Original Message- From: Wagoner, Mark [mailto:[EMAIL PROTECTED]] Sent: 08 March 2002 14:52 To: 'Tomcat Users List' Subject:RE: How can I resolve this IllegalStateException: Response has a lrea dy been committed problem? Actually, the way forward works came as a surprise to me as well. And I only figured it out after a few days of testing and head-scratching. :) Since the session is held in the request object, changes made to it should be available to the original Home servlet by calling request.getSession after the forward call returns. Obviously I'm not real familiar with what you are trying to do, but there may be a way you can eliminate the last forward back to the home servlet. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Friday, March 08, 2002 9:44 AM To: [EMAIL PROTECTED] Subject: RE: How can I resolve this IllegalStateException: Response has a lrea dy been committed problem? Don't think JSP is failing. It's quite a simple JSP and has been looked at exhaustively! Yes, I am setting session attributes in Create servlet, for use by create.jsp. I am only using the session object and the request throughout my application. The only time I ever knew I was using the response object was when I used response.sendRedirect(), but I don't use this anymore. I use the RequestDispatcher. There are no jsp:include or jsp:forward tags being used anywhere, and my servlets do not contribute anything to the response (apart from forwarding it around). Mark - your words of wisdom interest me. I thought that... when I invoke requestDispatcher.forward(), then control never returns (to the line following this invocation). So how do I go about returning to the Home servlet from the Create servlet. Surely I need to forward, because the session has changed? I have a lot to learn here I think, but I feel I'm getting closer to the holy grail - getting rid of this exception! -Original Message- From: Attila Szegedi [mailto:[EMAIL PROTECTED]] Sent: 08 March 2002 13:56 To: Tomcat Users List Subject:Re: How can I resolve this IllegalStateException: Response has a lrea dy been committed problem? I guess you JSP is failing with an uncaught exception. At that point, Tomcat would try to send a 500 Internal Server Error response code, but it can't since a 200 OK status code has already been sent (that is, the output committed) to the client. -- Attila Szegedi home: http://www.szegedi.org - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: 2002. március 8. 14:45 Subject: RE: How can I resolve this IllegalStateException: Response has a lrea dy been committed problem? The exception seems to be occurring because the Home servlet forwards more than once (to different locations) - first to home.jsp, then later to the Create servlet. It is definitely the fact that it is forwarding to more than one place, that is causing the problem. I know this because if I call the Login servlet and fail the login authorization - this servlet consequently forwards to login.jsp more than once (first - to display the fresh login page, and second - to prompt user to try again). This however does not give me an exception. Given that my Home servlet is like the central servlet, it needs to be capable of forwarding to a variety of places, depending on the activity selected by the user. Ryan - I have looked at create.jsp and, as far as my little mind can see, it does not play with the response object at all. All it does is get a few session attributes and fit them into the page using %= blablabla %. Could that be a problem? This problem is not isolated to the Create example. There are other activities the user can choose which all follow exactly the same forwarding mechanism (except to different servlets), and these give exactly the same exception. Lindsay -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED] -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED] -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED] -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional
RE: How can I resolve this IllegalStateException: Response has a lrea dy been committed problem?
It should be the same session object. Ryan Daigle Java Developer Health Decisions, Inc. 1512 E. Franklin St, Suite 200 Chapel Hill, NC 27514 (919) 967-2399 ext: 251 [EMAIL PROTECTED] http://www.healthdec.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Friday, March 08, 2002 10:06 AM To: [EMAIL PROTECTED] Subject: RE: How can I resolve this IllegalStateException: Response has a lrea dy been committed problem? OK. I never knew the forward call actually returned - ever. I will experiment with this. I'm nearly ready to go away and stop pestering you all, but one more question... Say the Home servlet gets the session object from the request. It later forwards the request to the Create servlet, which essentially modifies the session. Then, when the forward call returns, will the Home servlet's session object be the old one or the updated one? Or will it have to do request.getSession() all over again in order to get latest session. Cheers, Lindsay -Original Message- From: Wagoner, Mark [mailto:[EMAIL PROTECTED]] Sent: 08 March 2002 14:52 To: 'Tomcat Users List' Subject:RE: How can I resolve this IllegalStateException: Response has a lrea dy been committed problem? Actually, the way forward works came as a surprise to me as well. And I only figured it out after a few days of testing and head-scratching. :) Since the session is held in the request object, changes made to it should be available to the original Home servlet by calling request.getSession after the forward call returns. Obviously I'm not real familiar with what you are trying to do, but there may be a way you can eliminate the last forward back to the home servlet. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Friday, March 08, 2002 9:44 AM To: [EMAIL PROTECTED] Subject: RE: How can I resolve this IllegalStateException: Response has a lrea dy been committed problem? Don't think JSP is failing. It's quite a simple JSP and has been looked at exhaustively! Yes, I am setting session attributes in Create servlet, for use by create.jsp. I am only using the session object and the request throughout my application. The only time I ever knew I was using the response object was when I used response.sendRedirect(), but I don't use this anymore. I use the RequestDispatcher. There are no jsp:include or jsp:forward tags being used anywhere, and my servlets do not contribute anything to the response (apart from forwarding it around). Mark - your words of wisdom interest me. I thought that... when I invoke requestDispatcher.forward(), then control never returns (to the line following this invocation). So how do I go about returning to the Home servlet from the Create servlet. Surely I need to forward, because the session has changed? I have a lot to learn here I think, but I feel I'm getting closer to the holy grail - getting rid of this exception! -Original Message- From: Attila Szegedi [mailto:[EMAIL PROTECTED]] Sent: 08 March 2002 13:56 To: Tomcat Users List Subject:Re: How can I resolve this IllegalStateException: Response has a lrea dy been committed problem? I guess you JSP is failing with an uncaught exception. At that point, Tomcat would try to send a 500 Internal Server Error response code, but it can't since a 200 OK status code has already been sent (that is, the output committed) to the client. -- Attila Szegedi home: http://www.szegedi.org - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: 2002. március 8. 14:45 Subject: RE: How can I resolve this IllegalStateException: Response has a lrea dy been committed problem? The exception seems to be occurring because the Home servlet forwards more than once (to different locations) - first to home.jsp, then later to the Create servlet. It is definitely the fact that it is forwarding to more than one place, that is causing the problem. I know this because if I call the Login servlet and fail the login authorization - this servlet consequently forwards to login.jsp more than once (first - to display the fresh login page, and second - to prompt user to try again). This however does not give me an exception. Given that my Home servlet is like the central servlet, it needs to be capable of forwarding to a variety of places, depending on the activity selected by the user. Ryan - I have looked at create.jsp and, as far as my little mind can see, it does not play with the response object at all. All it does is get a few session attributes and fit them into the page using %= blablabla %. Could that be a problem? This problem is not isolated to the Create example. There are other activities the user can choose which all follow exactly the same forwarding mechanism (except to different servlets), and these give exactly the same exception. Lindsay -- To unsubscribe: mailto:[EMAIL
RE: How can I resolve this IllegalStateException: Response has a lrea dy been committed problem?
Because the Home servlet holds an object reference to the session, it acts as a pointer to the actual object data. If another servlet obtains a pointer to the same object and modifies the data, the changes will be reflected in the first servlet without having to re-get the reference. However, as a precaution I don't like to hold object references between calls like this. Maybe I'm just anal... -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Friday, March 08, 2002 10:06 AM To: [EMAIL PROTECTED] Subject: RE: How can I resolve this IllegalStateException: Response has a lrea dy been committed problem? OK. I never knew the forward call actually returned - ever. I will experiment with this. I'm nearly ready to go away and stop pestering you all, but one more question... Say the Home servlet gets the session object from the request. It later forwards the request to the Create servlet, which essentially modifies the session. Then, when the forward call returns, will the Home servlet's session object be the old one or the updated one? Or will it have to do request.getSession() all over again in order to get latest session. Cheers, Lindsay -Original Message- From: Wagoner, Mark [mailto:[EMAIL PROTECTED]] Sent: 08 March 2002 14:52 To: 'Tomcat Users List' Subject:RE: How can I resolve this IllegalStateException: Response has a lrea dy been committed problem? Actually, the way forward works came as a surprise to me as well. And I only figured it out after a few days of testing and head-scratching. :) Since the session is held in the request object, changes made to it should be available to the original Home servlet by calling request.getSession after the forward call returns. Obviously I'm not real familiar with what you are trying to do, but there may be a way you can eliminate the last forward back to the home servlet. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Friday, March 08, 2002 9:44 AM To: [EMAIL PROTECTED] Subject: RE: How can I resolve this IllegalStateException: Response has a lrea dy been committed problem? Don't think JSP is failing. It's quite a simple JSP and has been looked at exhaustively! Yes, I am setting session attributes in Create servlet, for use by create.jsp. I am only using the session object and the request throughout my application. The only time I ever knew I was using the response object was when I used response.sendRedirect(), but I don't use this anymore. I use the RequestDispatcher. There are no jsp:include or jsp:forward tags being used anywhere, and my servlets do not contribute anything to the response (apart from forwarding it around). Mark - your words of wisdom interest me. I thought that... when I invoke requestDispatcher.forward(), then control never returns (to the line following this invocation). So how do I go about returning to the Home servlet from the Create servlet. Surely I need to forward, because the session has changed? I have a lot to learn here I think, but I feel I'm getting closer to the holy grail - getting rid of this exception! -Original Message- From: Attila Szegedi [mailto:[EMAIL PROTECTED]] Sent: 08 March 2002 13:56 To: Tomcat Users List Subject:Re: How can I resolve this IllegalStateException: Response has a lrea dy been committed problem? I guess you JSP is failing with an uncaught exception. At that point, Tomcat would try to send a 500 Internal Server Error response code, but it can't since a 200 OK status code has already been sent (that is, the output committed) to the client. -- Attila Szegedi home: http://www.szegedi.org - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: 2002. március 8. 14:45 Subject: RE: How can I resolve this IllegalStateException: Response has a lrea dy been committed problem? The exception seems to be occurring because the Home servlet forwards more than once (to different locations) - first to home.jsp, then later to the Create servlet. It is definitely the fact that it is forwarding to more than one place, that is causing the problem. I know this because if I call the Login servlet and fail the login authorization - this servlet consequently forwards to login.jsp more than once (first - to display the fresh login page, and second - to prompt user to try again). This however does not give me an exception. Given that my Home servlet is like the central servlet, it needs to be capable of forwarding to a variety of places, depending on the activity selected by the user. Ryan - I have looked at create.jsp and, as far as my little mind can see, it does not play with the response object at all. All it does is get a few session attributes and fit them into the page using %= blablabla %. Could that be a problem? This problem is not isolated to the Create example. There are other activities the user can choose which
RE: How can I resolve this IllegalStateException: Response has a lrea dybeen committed problem?
If you are getting any pages back from the server, then you are using the response object! You may not be manipulating it with an explicit reference to it, but, when you have HTML or do an % out.println(STUFF) % or output a JSP expression like %= something % in your JSP pages, you are using the response object. And the deal is you can't forward if you've already started putting stuff in the response. What you should probably look into, and what some people are hinting at here, is using some sort of controller servlet that gets the request and then CALLS (not forwards to) the appropriate handler or action class. You can pass the request object along to your handler class so that you can get stuff from it or its session. Then, when your handler method is finished, you controller picks up immediately following its call to your handler. This allows you to have one very general controller servlet which can route the requests to more specialized handlers or actions depending on some parameter (command, action name) and can then handle forwarding to the appropriate new page. You might want to take a look at the Struts framework, which does this for you. Hope this helps. -Jeff lindsay.hamou [EMAIL PROTECTED]To: [EMAIL PROTECTED] cc: 03/08/02 Subject: RE: How can I resolve this IllegalStateException: Response 08:43 AM has a lrea dy been committed problem? Please respond to Tomcat Users List Don't think JSP is failing. It's quite a simple JSP and has been looked at exhaustively! Yes, I am setting session attributes in Create servlet, for use by create.jsp. I am only using the session object and the request throughout my application. The only time I ever knew I was using the response object was when I used response.sendRedirect(), but I don't use this anymore. I use the RequestDispatcher. There are no jsp:include or jsp:forward tags being used anywhere, and my servlets do not contribute anything to the response (apart from forwarding it around). Mark - your words of wisdom interest me. I thought that... when I invoke requestDispatcher.forward(), then control never returns (to the line following this invocation). So how do I go about returning to the Home servlet from the Create servlet. Surely I need to forward, because the session has changed? I have a lot to learn here I think, but I feel I'm getting closer to the holy grail - getting rid of this exception! -Original Message- From: Attila Szegedi [mailto:[EMAIL PROTECTED]] Sent: 08 March 2002 13:56 To:Tomcat Users List Subject:Re: How can I resolve this IllegalStateException: Response has a lrea dy been committed problem? I guess you JSP is failing with an uncaught exception. At that point, Tomcat would try to send a 500 Internal Server Error response code, but it can't since a 200 OK status code has already been sent (that is, the output committed) to the client. -- Attila Szegedi home: http://www.szegedi.org - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: 2002. március 8. 14:45 Subject: RE: How can I resolve this IllegalStateException: Response has a lrea dy been committed problem? The exception seems to be occurring because the Home servlet forwards more than once (to different locations) - first to home.jsp, then later to the Create servlet. It is definitely the fact that it is forwarding to more than one place, that is causing the problem. I know this because if I call the Login servlet and fail the login authorization - this servlet consequently forwards to login.jsp more than once (first - to display the fresh login page, and second - to prompt user to try again). This however does not give me an exception. Given that my Home servlet is like the central servlet, it needs
IllegalStateException: Session already invalidated
I get the following error sometimes when I have had tomcat running for a while, but have had little or no activity in the sessions. When I call session.getAttribute(attributeName), I get the error: java.lang.IllegalStateException: getAttribute: Session already invalidated at org.apache.tomcat.session.StandardSession.getAttribute(StandardSession.java:503) at login.SessionController.addSessionManager(SessionController.java:80) at login.SystemManager.login(SystemManager.java:173) My question is: why does this happen? Is there a setting in web.xml or server.xml or elsewhere that I can change so that sessions do not time out (so that they are not invalidated)? Operating system: Windows 2000 Java version: Java 1.2 with Java Servlet 2.2 and JSP 1.1 specifications. Web server: Apache 1_3_22 with mod_jk Servlet engine: Tomcat 3.2.3 Thanks, Egil Rian - Egil Rian San Francisco, CA 94131 _ Chat with friends online, try MSN Messenger: http://messenger.msn.com -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED]
IllegalStateException: Session already invalidated
I get the following error sometimes when I have let the tomcat running for a while, but have had little or no activity in the sessions. When I call session.getAttribute(attributeName), I get the error: java.lang.IllegalStateException: getAttribute: Session already invalidated at org.apache.tomcat.session.StandardSession.getAttribute(StandardSession.java:503) at login.SessionController.addSessionManager(SessionController.java:80) at login.SystemManager.login(SystemManager.java:173) My question is: why does this happen? Is there a setting in web.xml or server.xml or elsewhere that I can change so that sessions do not time out / are not invalidated? Operating system: Windows 2000 Java version: Java 1.2 with Java Servlet 2.2 and JSP 1.1 Web server: Apache 1_3_22 Servlet engine: Tomcat 3.2.3 Thanks, Egil Rian - Egil Rian San Francisco, CA 94131 _ Send and receive Hotmail on your mobile device: http://mobile.msn.com -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED]
IllegalStateException in releasePageContext
I have upgraded from Tomcat 3.2.2 to Tomcat 4.0.1, and I am now receiving many errors in my error log (one for each time a user hits a .jsp page.) This is causing my logs to grow VERY quickly. I did not receive these types of errors in 3.2.x. The errors are all in the following format: 2002-01-25 08:07:55 StandardWrapperValve[jsp]: Servlet.service() for servlet jsp threw exception java.lang.IllegalStateException at org.apache.catalina.connector.ResponseFacade.getWriter (ResponseFacade.java:159) (pc 11) at org.apache.jasper.runtime.JspWriterImpl.initOut (JspWriterImpl.java:166) (pc 12) at org.apache.jasper.runtime.JspWriterImpl.flushBuffer (JspWriterImpl.java:158) (pc 39) at org.apache.jasper.runtime.JspWriterImpl.flush (JspWriterImpl.java:205) (pc 8) at org.apache.jasper.runtime.PageContextImpl.release (PageContextImpl.java:176) (pc 24) at org.apache.jasper.runtime.JspFactoryImpl.internalReleasePageContext (JspFactoryImpl.java:198) (pc 1) at org.apache.jasper.runtime.JspFactoryImpl.releasePageContext (JspFactoryImpl.java:193) (pc 32) at org.apache.jsp.eppersonal$jsp._jspService (eppersonal$jsp.java:270) (pc 1207) at org.apache.jasper.runtime.HttpJspBase.service (HttpJspBase.java:107) (pc 3) at javax.servlet.http.HttpServlet.service(javax.servlet.ServletRequest,java x.servlet.ServletResponse) (HttpServlet.java:853) (pc 30) at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service (JspServlet.java:199) (pc 33) at org.apache.jasper.servlet.JspServlet.serviceJspFile (JspServlet.java:382) (pc 60) at org.apache.jasper.servlet.JspServlet.service (JspServlet.java:474) (pc 326) at javax.servlet.http.HttpServlet.service(javax.servlet.ServletRequest,java x.servlet.ServletResponse) (HttpServlet.java:853) (pc 30) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter (ApplicationFilterChain.java:247) (pc 248) at org.apache.catalina.core.ApplicationFilterChain.doFilter (ApplicationFilterChain.java:193) (pc 98) at org.apache.catalina.core.StandardWrapperValve.invoke (StandardWrapperValve.java:243) (pc 352) at org.apache.catalina.core.StandardPipeline.invokeNext (StandardPipeline.java:566) (pc 87) at org.apache.catalina.core.StandardPipeline.invoke (StandardPipeline.java:472) (pc 18) at org.apache.catalina.core.ContainerBase.invoke (ContainerBase.java:943) (pc 6) at org.apache.catalina.core.StandardContextValve.invoke (StandardContextValve.java:201) (pc 261) at org.apache.catalina.core.StandardPipeline.invokeNext (StandardPipeline.java:566) (pc 87) at org.apache.catalina.valves.CertificatesValve.invoke (CertificatesValve.java:246) (pc 48) at org.apache.catalina.core.StandardPipeline.invokeNext (StandardPipeline.java:564) (pc 55) at org.apache.catalina.core.StandardPipeline.invoke (StandardPipeline.java:472) (pc 18) at org.apache.catalina.core.ContainerBase.invoke (ContainerBase.java:943) (pc 6) at org.apache.catalina.core.StandardContext.invoke (StandardContext.java:2344) (pc 26) at org.apache.catalina.core.StandardHostValve.invoke (StandardHostValve.java:164) (pc 99) at org.apache.catalina.core.StandardPipeline.invokeNext (StandardPipeline.java:566) (pc 87) at org.apache.catalina.valves.ErrorDispatcherValve.invoke (ErrorDispatcherValve.java:170) (pc 3) at org.apache.catalina.core.StandardPipeline.invokeNext (StandardPipeline.java:564) (pc 55) at org.apache.catalina.valves.ErrorReportValve.invoke (ErrorReportValve.java:170) (pc 3) at org.apache.catalina.core.StandardPipeline.invokeNext (StandardPipeline.java:564) (pc 55) at org.apache.catalina.valves.AccessLogValve.invoke (AccessLogValve.java:462) (pc 3) at org.apache.catalina.core.StandardPipeline.invokeNext (StandardPipeline.java:564) (pc 55) at org.apache.catalina.core.StandardPipeline.invoke (StandardPipeline.java:472) (pc 18) at org.apache.catalina.core.ContainerBase.invoke (ContainerBase.java:943) (pc 6) at org.apache.catalina.core.StandardEngineValve.invoke (StandardEngineValve.java:163) (pc 92) at org.apache.catalina.core.StandardPipeline.invokeNext (StandardPipeline.java:566) (pc 87) at org.apache.catalina.core.StandardPipeline.invoke (StandardPipeline.java:472) (pc 18) at org.apache.catalina.core.ContainerBase.invoke (ContainerBase.java:943) (pc 6) at org.apache.catalina.connector.http.HttpProcessor.process (HttpProcessor.java:1011) (pc 363) at org.apache.catalina.connector.http.HttpProcessor.run (HttpProcessor.java:1106) (pc 14) at java.lang.Thread.run (Thread.java:484) (pc 11) The only part of the trace that is mine is the following: at org.apache.jsp.eppersonal$jsp._jspService (eppersonal$jsp.java:270) (pc 1207) Here is the offending code: } catch
RE: IllegalStateException in releasePageContext
Do you happen to have include directives with flush=true. If so, take the flush attribute out. This helped me, anyway. -Original Message- From: Robert Winningham [mailto:[EMAIL PROTECTED]] Sent: Friday, January 25, 2002 9:46 AM To: [EMAIL PROTECTED] Subject: IllegalStateException in releasePageContext I have upgraded from Tomcat 3.2.2 to Tomcat 4.0.1, and I am now receiving many errors in my error log (one for each time a user hits a .jsp page.) This is causing my logs to grow VERY quickly. I did not receive these types of errors in 3.2.x. The errors are all in the following format: 2002-01-25 08:07:55 StandardWrapperValve[jsp]: Servlet.service() for servlet jsp threw exception java.lang.IllegalStateException at org.apache.catalina.connector.ResponseFacade.getWriter (ResponseFacade.java:159) (pc 11) at org.apache.jasper.runtime.JspWriterImpl.initOut (JspWriterImpl.java:166) (pc 12) at org.apache.jasper.runtime.JspWriterImpl.flushBuffer (JspWriterImpl.java:158) (pc 39) at org.apache.jasper.runtime.JspWriterImpl.flush (JspWriterImpl.java:205) (pc 8) at org.apache.jasper.runtime.PageContextImpl.release (PageContextImpl.java:176) (pc 24) at org.apache.jasper.runtime.JspFactoryImpl.internalReleasePageContext (JspFactoryImpl.java:198) (pc 1) at org.apache.jasper.runtime.JspFactoryImpl.releasePageContext (JspFactoryImpl.java:193) (pc 32) at org.apache.jsp.eppersonal$jsp._jspService (eppersonal$jsp.java:270) (pc 1207) at org.apache.jasper.runtime.HttpJspBase.service (HttpJspBase.java:107) (pc 3) at javax.servlet.http.HttpServlet.service(javax.servlet.ServletRequest,java x.servlet.ServletResponse) (HttpServlet.java:853) (pc 30) at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service (JspServlet.java:199) (pc 33) at org.apache.jasper.servlet.JspServlet.serviceJspFile (JspServlet.java:382) (pc 60) at org.apache.jasper.servlet.JspServlet.service (JspServlet.java:474) (pc 326) at javax.servlet.http.HttpServlet.service(javax.servlet.ServletRequest,java x.servlet.ServletResponse) (HttpServlet.java:853) (pc 30) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter (ApplicationFilterChain.java:247) (pc 248) at org.apache.catalina.core.ApplicationFilterChain.doFilter (ApplicationFilterChain.java:193) (pc 98) at org.apache.catalina.core.StandardWrapperValve.invoke (StandardWrapperValve.java:243) (pc 352) at org.apache.catalina.core.StandardPipeline.invokeNext (StandardPipeline.java:566) (pc 87) at org.apache.catalina.core.StandardPipeline.invoke (StandardPipeline.java:472) (pc 18) at org.apache.catalina.core.ContainerBase.invoke (ContainerBase.java:943) (pc 6) at org.apache.catalina.core.StandardContextValve.invoke (StandardContextValve.java:201) (pc 261) at org.apache.catalina.core.StandardPipeline.invokeNext (StandardPipeline.java:566) (pc 87) at org.apache.catalina.valves.CertificatesValve.invoke (CertificatesValve.java:246) (pc 48) at org.apache.catalina.core.StandardPipeline.invokeNext (StandardPipeline.java:564) (pc 55) at org.apache.catalina.core.StandardPipeline.invoke (StandardPipeline.java:472) (pc 18) at org.apache.catalina.core.ContainerBase.invoke (ContainerBase.java:943) (pc 6) at org.apache.catalina.core.StandardContext.invoke (StandardContext.java:2344) (pc 26) at org.apache.catalina.core.StandardHostValve.invoke (StandardHostValve.java:164) (pc 99) at org.apache.catalina.core.StandardPipeline.invokeNext (StandardPipeline.java:566) (pc 87) at org.apache.catalina.valves.ErrorDispatcherValve.invoke (ErrorDispatcherValve.java:170) (pc 3) at org.apache.catalina.core.StandardPipeline.invokeNext (StandardPipeline.java:564) (pc 55) at org.apache.catalina.valves.ErrorReportValve.invoke (ErrorReportValve.java:170) (pc 3) at org.apache.catalina.core.StandardPipeline.invokeNext (StandardPipeline.java:564) (pc 55) at org.apache.catalina.valves.AccessLogValve.invoke (AccessLogValve.java:462) (pc 3) at org.apache.catalina.core.StandardPipeline.invokeNext (StandardPipeline.java:564) (pc 55) at org.apache.catalina.core.StandardPipeline.invoke (StandardPipeline.java:472) (pc 18) at org.apache.catalina.core.ContainerBase.invoke (ContainerBase.java:943) (pc 6) at org.apache.catalina.core.StandardEngineValve.invoke (StandardEngineValve.java:163) (pc 92) at org.apache.catalina.core.StandardPipeline.invokeNext (StandardPipeline.java:566) (pc 87) at org.apache.catalina.core.StandardPipeline.invoke (StandardPipeline.java:472) (pc 18) at org.apache.catalina.core.ContainerBase.invoke (ContainerBase.java:943) (pc 6) at org.apache.catalina.connector.http.HttpProcessor.process (HttpProcessor.java:1011) (pc 363
RE: IllegalStateException in releasePageContext
Mark, Thank you for your advice. I tried your recommendation, but I am still receiving the errors. Any other thoughts? Any advice is much appreciated. //rob -Original Message- From: Wagoner, Mark [mailto:[EMAIL PROTECTED]] Sent: Friday, January 25, 2002 8:56 AM To: 'Tomcat Users List' Subject: RE: IllegalStateException in releasePageContext Do you happen to have include directives with flush=true. If so, take the flush attribute out. This helped me, anyway. -Original Message- From: Robert Winningham [mailto:[EMAIL PROTECTED]] Sent: Friday, January 25, 2002 9:46 AM To: [EMAIL PROTECTED] Subject: IllegalStateException in releasePageContext I have upgraded from Tomcat 3.2.2 to Tomcat 4.0.1, and I am now receiving many errors in my error log (one for each time a user hits a .jsp page.) This is causing my logs to grow VERY quickly. I did not receive these types of errors in 3.2.x. The errors are all in the following format: 2002-01-25 08:07:55 StandardWrapperValve[jsp]: Servlet.service() for servlet jsp threw exception java.lang.IllegalStateException at org.apache.catalina.connector.ResponseFacade.getWriter (ResponseFacade.java:159) (pc 11) at org.apache.jasper.runtime.JspWriterImpl.initOut (JspWriterImpl.java:166) (pc 12) at org.apache.jasper.runtime.JspWriterImpl.flushBuffer (JspWriterImpl.java:158) (pc 39) at org.apache.jasper.runtime.JspWriterImpl.flush (JspWriterImpl.java:205) (pc 8) at org.apache.jasper.runtime.PageContextImpl.release (PageContextImpl.java:176) (pc 24) at org.apache.jasper.runtime.JspFactoryImpl.internalReleasePageContext (JspFactoryImpl.java:198) (pc 1) at org.apache.jasper.runtime.JspFactoryImpl.releasePageContext (JspFactoryImpl.java:193) (pc 32) at org.apache.jsp.eppersonal$jsp._jspService (eppersonal$jsp.java:270) (pc 1207) at org.apache.jasper.runtime.HttpJspBase.service (HttpJspBase.java:107) (pc 3) at javax.servlet.http.HttpServlet.service(javax.servlet.ServletRequest,java x.servlet.ServletResponse) (HttpServlet.java:853) (pc 30) at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service (JspServlet.java:199) (pc 33) at org.apache.jasper.servlet.JspServlet.serviceJspFile (JspServlet.java:382) (pc 60) at org.apache.jasper.servlet.JspServlet.service (JspServlet.java:474) (pc 326) at javax.servlet.http.HttpServlet.service(javax.servlet.ServletRequest,java x.servlet.ServletResponse) (HttpServlet.java:853) (pc 30) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter (ApplicationFilterChain.java:247) (pc 248) at org.apache.catalina.core.ApplicationFilterChain.doFilter (ApplicationFilterChain.java:193) (pc 98) at org.apache.catalina.core.StandardWrapperValve.invoke (StandardWrapperValve.java:243) (pc 352) at org.apache.catalina.core.StandardPipeline.invokeNext (StandardPipeline.java:566) (pc 87) at org.apache.catalina.core.StandardPipeline.invoke (StandardPipeline.java:472) (pc 18) at org.apache.catalina.core.ContainerBase.invoke (ContainerBase.java:943) (pc 6) at org.apache.catalina.core.StandardContextValve.invoke (StandardContextValve.java:201) (pc 261) at org.apache.catalina.core.StandardPipeline.invokeNext (StandardPipeline.java:566) (pc 87) at org.apache.catalina.valves.CertificatesValve.invoke (CertificatesValve.java:246) (pc 48) at org.apache.catalina.core.StandardPipeline.invokeNext (StandardPipeline.java:564) (pc 55) at org.apache.catalina.core.StandardPipeline.invoke (StandardPipeline.java:472) (pc 18) at org.apache.catalina.core.ContainerBase.invoke (ContainerBase.java:943) (pc 6) at org.apache.catalina.core.StandardContext.invoke (StandardContext.java:2344) (pc 26) at org.apache.catalina.core.StandardHostValve.invoke (StandardHostValve.java:164) (pc 99) at org.apache.catalina.core.StandardPipeline.invokeNext (StandardPipeline.java:566) (pc 87) at org.apache.catalina.valves.ErrorDispatcherValve.invoke (ErrorDispatcherValve.java:170) (pc 3) at org.apache.catalina.core.StandardPipeline.invokeNext (StandardPipeline.java:564) (pc 55) at org.apache.catalina.valves.ErrorReportValve.invoke (ErrorReportValve.java:170) (pc 3) at org.apache.catalina.core.StandardPipeline.invokeNext (StandardPipeline.java:564) (pc 55) at org.apache.catalina.valves.AccessLogValve.invoke (AccessLogValve.java:462) (pc 3) at org.apache.catalina.core.StandardPipeline.invokeNext (StandardPipeline.java:564) (pc 55) at org.apache.catalina.core.StandardPipeline.invoke (StandardPipeline.java:472) (pc 18) at org.apache.catalina.core.ContainerBase.invoke (ContainerBase.java:943) (pc 6) at org.apache.catalina.core.StandardEngineValve.invoke (StandardEngineValve.java:163) (pc 92) at org.apache.catalina.core.StandardPipeline.invokeNext
RE: IllegalStateException in releasePageContext
(HttpProcessor.java:1106) (pc 14) at java.lang.Thread.run (Thread.java:484) (pc 11) Here's a code snippet where the error is occurring... } catch (Throwable t) { if (out != null out.getBufferSize() != 0) out.clearBuffer(); if (pageContext != null) pageContext.handlePageException(t); } finally { Line 75if (_jspxFactory != null) _jspxFactory.releasePageContext(pageContext); } -Original Message- From: Wagoner, Mark [mailto:[EMAIL PROTECTED]] Sent: Friday, January 25, 2002 8:56 AM To: 'Tomcat Users List' Subject: RE: IllegalStateException in releasePageContext Do you happen to have include directives with flush=true. If so, take the flush attribute out. This helped me, anyway. -Original Message- From: Robert Winningham [mailto:[EMAIL PROTECTED]] Sent: Friday, January 25, 2002 9:46 AM To: [EMAIL PROTECTED] Subject: IllegalStateException in releasePageContext I have upgraded from Tomcat 3.2.2 to Tomcat 4.0.1, and I am now receiving many errors in my error log (one for each time a user hits a .jsp page.) This is causing my logs to grow VERY quickly. I did not receive these types of errors in 3.2.x. The errors are all in the following format: 2002-01-25 08:07:55 StandardWrapperValve[jsp]: Servlet.service() for servlet jsp threw exception java.lang.IllegalStateException at org.apache.catalina.connector.ResponseFacade.getWriter (ResponseFacade.java:159) (pc 11) at org.apache.jasper.runtime.JspWriterImpl.initOut (JspWriterImpl.java:166) (pc 12) at org.apache.jasper.runtime.JspWriterImpl.flushBuffer (JspWriterImpl.java:158) (pc 39) at org.apache.jasper.runtime.JspWriterImpl.flush (JspWriterImpl.java:205) (pc 8) at org.apache.jasper.runtime.PageContextImpl.release (PageContextImpl.java:176) (pc 24) at org.apache.jasper.runtime.JspFactoryImpl.internalReleasePageContext (JspFactoryImpl.java:198) (pc 1) at org.apache.jasper.runtime.JspFactoryImpl.releasePageContext (JspFactoryImpl.java:193) (pc 32) at org.apache.jsp.eppersonal$jsp._jspService (eppersonal$jsp.java:270) (pc 1207) at org.apache.jasper.runtime.HttpJspBase.service (HttpJspBase.java:107) (pc 3) at javax.servlet.http.HttpServlet.service(javax.servlet.ServletRequest,java x.servlet.ServletResponse) (HttpServlet.java:853) (pc 30) at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service (JspServlet.java:199) (pc 33) at org.apache.jasper.servlet.JspServlet.serviceJspFile (JspServlet.java:382) (pc 60) at org.apache.jasper.servlet.JspServlet.service (JspServlet.java:474) (pc 326) at javax.servlet.http.HttpServlet.service(javax.servlet.ServletRequest,java x.servlet.ServletResponse) (HttpServlet.java:853) (pc 30) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter (ApplicationFilterChain.java:247) (pc 248) at org.apache.catalina.core.ApplicationFilterChain.doFilter (ApplicationFilterChain.java:193) (pc 98) at org.apache.catalina.core.StandardWrapperValve.invoke (StandardWrapperValve.java:243) (pc 352) at org.apache.catalina.core.StandardPipeline.invokeNext (StandardPipeline.java:566) (pc 87) at org.apache.catalina.core.StandardPipeline.invoke (StandardPipeline.java:472) (pc 18) at org.apache.catalina.core.ContainerBase.invoke (ContainerBase.java:943) (pc 6) at org.apache.catalina.core.StandardContextValve.invoke (StandardContextValve.java:201) (pc 261) at org.apache.catalina.core.StandardPipeline.invokeNext (StandardPipeline.java:566) (pc 87) at org.apache.catalina.valves.CertificatesValve.invoke (CertificatesValve.java:246) (pc 48) at org.apache.catalina.core.StandardPipeline.invokeNext (StandardPipeline.java:564) (pc 55) at org.apache.catalina.core.StandardPipeline.invoke (StandardPipeline.java:472) (pc 18) at org.apache.catalina.core.ContainerBase.invoke (ContainerBase.java:943) (pc 6) at org.apache.catalina.core.StandardContext.invoke (StandardContext.java:2344) (pc 26) at org.apache.catalina.core.StandardHostValve.invoke (StandardHostValve.java:164) (pc 99) at org.apache.catalina.core.StandardPipeline.invokeNext (StandardPipeline.java:566) (pc 87) at org.apache.catalina.valves.ErrorDispatcherValve.invoke (ErrorDispatcherValve.java:170) (pc 3) at org.apache.catalina.core.StandardPipeline.invokeNext (StandardPipeline.java:564) (pc 55) at org.apache.catalina.valves.ErrorReportValve.invoke (ErrorReportValve.java:170) (pc 3) at org.apache.catalina.core.StandardPipeline.invokeNext (StandardPipeline.java:564) (pc 55) at org.apache.catalina.valves.AccessLogValve.invoke (AccessLogValve.java:462) (pc 3) at org.apache.catalina.core.StandardPipeline.invokeNext (StandardPipeline.java:564) (pc 55) at org.apache.catalina.core.StandardPipeline.invoke (StandardPipeline.java:472) (pc 18
Tomcat 3.3 ThreadPool throws IllegalStateException
Hi there, I am having a problem with the Tomcat 3.3 running on Solaris 8. The Tomcat is breaking up with the following message: Stop reaper ThreadPool: Caught exception executing org.apache.tomcat.util.net.TcpWorkerThread@9dfb6, terminating thread java.lang.IllegalStateException at org.apache.tomcat.util.threads.ThreadPool.runIt(Unknown Source) at org.apache.tomcat.util.net.TcpWorkerThread.runIt(Unknown Source) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(Unknown Source) at java.lang.Thread.run(Thread.java:484) What could be the posible cause for this behaviour ? How could I monitor the status of the ThreadPool ? Thanks for your help Drasko -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED]
IllegalStateException
Hello, I am running Tomcat 3.2.3 on a Sparc-Solaris 8 machine. My servlets work fine for an undetermined period of time. Suddenly it enters on a loop printing the following message: 2001-11-22 04:03:26 - Ctx( /movious ): IllegalStateException in: R( /movious + / portal + null) Current state = FLUSHED, new state = CODING The only way to stop this is by restarting tomcat. The same servlets work fine on my Tomcat 3.2.3 installation on Windows 2000. Please Help. Ariel -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED]
IllegalStateException from jsp:include..
It looks like on a jsp:include from Tomcat 4.0.1 on Solaris x86 (JDK 1.3.1_01) I'm getting a IllegalStateException when the JSP engine actually attempts to include the file (Stack Trace from include in JSP is at the end). For the Apache side of things I've got document-root set to /www/si/sifk/ and a symlink from ${CATALINA_HOME}/webapps/ROOT/WEB-INF/classes to the actual location of all the Servlets in the document-root (NFS mounted to be spread across multiple machines and one deployment sport). Is there a way to get the JSP/Jasper engine to realize a different ROOT than the one the servlets are loaded from? I'd like to set the JSP root to the same as the Apache document-root so that all things are be dployed at once and I don't have to go and adjust symlinks for new things. I'm guess that it's either Jasper/Catalina/Tomcat or the JVM that's having an issue with attempting to include a file from a symlink. -- Steve Brunton [EMAIL PROTECTED] Phone: 404-827-2756 Chief Engineer Enterprise SystemsOne CNN Center, Atlanta GA CNN Internet Technologies ICBM: 84W 23' 45 33N 45' 29 * If one synchronized swimmer drowns, do the rest drown too? * -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Tomcat 4.0.1 IllegalStateException (was NOT in 4.0 final)
Hi, after updating to TC 4.0.1 I occasionally get the following exception: StandardWrapperValve[jsp]: Servlet.service() for servlet jsp threw exception java.lang.IllegalStateException at org.apache.catalina.connector.ResponseFacade.getWriter(ResponseFacade.java:1 59) at org.apache.jasper.runtime.JspWriterImpl.initOut(JspWriterImpl.java:166) at org.apache.jasper.runtime.JspWriterImpl.flushBuffer(JspWriterImpl.java:158) at org.apache.jasper.runtime.JspWriterImpl.flush(JspWriterImpl.java:205) at org.apache.jasper.runtime.PageContextImpl.release(PageContextImpl.java:176) at org.apache.jasper.runtime.JspFactoryImpl.internalReleasePageContext(JspFacto ryImpl.java:198) at org.apache.jasper.runtime.JspFactoryImpl.releasePageContext(JspFactoryImpl.j ava:193) at org.apache.jsp.page3$jsp._jspService(page3$jsp.java:3393) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.ja va:202) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:382) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:474) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application FilterChain.java:247) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh ain.java:193) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja va:243) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5 66) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja va:201) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5 66) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase .java:472) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5 64) at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:2 46) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5 64) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943) at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2344) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164 ) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5 66) at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve. java:170) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5 64) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170 ) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5 64) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:462) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5 64) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java :163) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5 66) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943) at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java: 1011) at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1106 ) at java.lang.Thread.run(Thread.java:484) It is not bound to a specific page (even if I reload the page that cause the error the exception does not reoccur) and the page is executed normally even if that exception occurs. In TC4.0 final I never got such an exception. After checking the catalina-source, I found out that the exception is raised if the response has been suspended. But I did not do such things explicitly. (and again, tomcat did not complain in version 4.0) I could ignore the exception (for it seems to have no impact on the jsp-execution), but of course it's not that nice. :-) So, any ideas what's going on? thanks, pero
update: Tomcat 4.0.1 IllegalStateException (was NOT in 4.0 final)
Hi, I found out that this happens mostly when using pageContext.forward(). I use this method before writing any html-code and I do a return; afterwards. Has anybody any clue? cheers, pero -Original Message- From: pero [mailto:[EMAIL PROTECTED]] Sent: Thursday, October 18, 2001 1:45 PM To: [EMAIL PROTECTED] Subject: Tomcat 4.0.1 IllegalStateException (was NOT in 4.0 final) Hi, after updating to TC 4.0.1 I occasionally get the following exception: StandardWrapperValve[jsp]: Servlet.service() for servlet jsp threw exception java.lang.IllegalStateException at org.apache.catalina.connector.ResponseFacade.getWriter(ResponseFac ade.java:1 59) at org.apache.jasper.runtime.JspWriterImpl.initOut(JspWriterImpl.java:166) at org.apache.jasper.runtime.JspWriterImpl.flushBuffer(JspWriterImpl. java:158) at org.apache.jasper.runtime.JspWriterImpl.flush(JspWriterImpl.java:205) at org.apache.jasper.runtime.PageContextImpl.release(PageContextImpl. java:176) at org.apache.jasper.runtime.JspFactoryImpl.internalReleasePageContex t(JspFacto ryImpl.java:198) at org.apache.jasper.runtime.JspFactoryImpl.releasePageContext(JspFac toryImpl.j ava:193) at org.apache.jsp.page3$jsp._jspService(page3$jsp.java:3393) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(Jsp Servlet.ja va:202) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:382) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:474) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(A pplication FilterChain.java:247) at org.apache.catalina.core.ApplicationFilterChain.doFilter(Applicati onFilterCh ain.java:193) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapp erValve.ja va:243) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipel ine.java:5 66) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline. java:472) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943) at org.apache.catalina.core.StandardContextValve.invoke(StandardConte xtValve.ja va:201) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipel ine.java:5 66) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(Authent icatorBase .java:472) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipel ine.java:5 64) at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesVa lve.java:2 46) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipel ine.java:5 64) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline. java:472) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943) at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2344) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValv e.java:164 ) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipel ine.java:5 66) at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispat cherValve. java:170) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipel ine.java:5 64) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValv e.java:170 ) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipel ine.java:5 64) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:462) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipel ine.java:5 64) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline. java:472) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngine Valve.java :163) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipel ine.java:5 66) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline. java:472) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943) at org.apache.catalina.connector.http.HttpProcessor.process(HttpProce ssor.java: 1011) at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor .java:1106 ) at java.lang.Thread.run(Thread.java:484) It is not bound to a specific page (even if I reload the page that cause the error the exception does not reoccur) and the page is executed normally even if that exception occurs
Re: update: Tomcat 4.0.1 IllegalStateException (was NOT in 4.0 final)
Hi, I found out that this happens mostly when using pageContext.forward(). I use this method before writing any html-code and I do a return; afterwards. Has anybody any clue? After a forward, the response is not modifiable anymore by the application. One modification which was added between 4.0 and 4.0.1 is that it will throw an ISE on most accesses, which on second thought may not be that good an idea, since that's not specified anywhere in the spec. In that particular case, Jasper would get a writer, but any attempt to write to it would result in an IOException. That problem did not appear in my testing. How do you reproduce the problem ? Remy
Re: IllegalStateException on jsp:include in simple jsp page
This simple tst.jsp page: !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.0 Transitional//EN html head titleTst.jsp/title link rel=stylesheet type=text/css href=tst.css jsp:include page=tst.js flush=true / /head body h1Tst.jsp is OK!/h1 /body /html is producing an IllegalStateException on the inclusion of the tst.js file when using the current jakarta-tomcat-4.0 binary release. The same tst.jsp file works fine when using the jakarta-tomcat-3.2.3 release. I don't see that I have much control preventing the call to obtain the request output stream so how do I prevent this error, and is this valid behavior? The full exception is given below as well as the tst.css and tst.js files. The behavior is valid, but is easy to fix. Here, the JSP page uses a writer. Since the static page server is also a servlet, it can't use an output stream to output the data (you'll get that ISE if you call getOutputStream()). It will attempt to use the writer in that particular case, but only if the file being included is a text file (it's the case here, but there's no MIME type for .js). The test used is that the MIME type of the included file has to be starting with text. Adding the following mapping in your web.xml should make it work: mime-mapping extensionjs/extension mime-typetext/plain/mime-type /mime-mapping Remy
IllegalStateException on jsp:include in simple jsp page
This simple tst.jsp page: !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.0 Transitional//EN html head titleTst.jsp/title link rel=stylesheet type=text/css href=tst.css jsp:include page=tst.js flush=true / /head body h1Tst.jsp is OK!/h1 /body /html is producing an IllegalStateException on the inclusion of the tst.js file when using the current jakarta-tomcat-4.0 binary release. The same tst.jsp file works fine when using the jakarta-tomcat-3.2.3 release. I don't see that I have much control preventing the call to obtain the request output stream so how do I prevent this error, and is this valid behavior? The full exception is given below as well as the tst.css and tst.js files. java.lang.IllegalStateException at org.apache.jasper.runtime.ServletResponseWrapperInclude.getOutputStream(Unkn own Source) at org.apache.catalina.servlets.DefaultServlet.serveResource(Unknown Source) at org.apache.catalina.servlets.DefaultServlet.doGet(Unknown Source) at javax.servlet.http.HttpServlet.service(HttpServlet.java:740) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.catalina.core.ApplicationDispatcher.invoke(Unknown Source) at org.apache.catalina.core.ApplicationDispatcher.doInclude(Unknown Source) at org.apache.catalina.core.ApplicationDispatcher.include(Unknown Source) at org.apache.jasper.runtime.JspRuntimeLibrary.include(Unknown Source) at org.apache.jsp.tst$jsp._jspService(tst$jsp.java:60) at org.apache.jasper.runtime.HttpJspBase.service(Unknown Source) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(Unknown Source) at org.apache.jasper.servlet.JspServlet.serviceJspFile(Unknown Source) at org.apache.jasper.servlet.JspServlet.service(Unknown Source) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Unknown Source) at org.apache.catalina.core.ApplicationFilterChain.doFilter(Unknown Source) at org.apache.catalina.core.StandardWrapperValve.invoke(Unknown Source) at org.apache.catalina.core.StandardPipeline.invokeNext(Unknown Source) at org.apache.catalina.core.StandardPipeline.invoke(Unknown Source) at org.apache.catalina.core.ContainerBase.invoke(Unknown Source) at org.apache.catalina.core.StandardContextValve.invoke(Unknown Source) at org.apache.catalina.core.StandardPipeline.invokeNext(Unknown Source) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(Unknown Source) at org.apache.catalina.core.StandardPipeline.invokeNext(Unknown Source) at org.apache.catalina.valves.CertificatesValve.invoke(Unknown Source) at org.apache.catalina.core.StandardPipeline.invokeNext(Unknown Source) at org.apache.catalina.core.StandardPipeline.invoke(Unknown Source) at org.apache.catalina.core.ContainerBase.invoke(Unknown Source) at org.apache.catalina.core.StandardContext.invoke(Unknown Source) at org.apache.catalina.core.StandardHostValve.invoke(Unknown Source) at org.apache.catalina.core.StandardPipeline.invokeNext(Unknown Source) at org.apache.catalina.valves.AccessLogValve.invoke(Unknown Source) at org.apache.catalina.core.StandardPipeline.invokeNext(Unknown Source) at org.apache.catalina.core.StandardPipeline.invoke(Unknown Source) at org.apache.catalina.core.ContainerBase.invoke(Unknown Source) at org.apache.catalina.core.StandardEngineValve.invoke(Unknown Source) at org.apache.catalina.core.StandardPipeline.invokeNext(Unknown Source) at org.apache.catalina.core.StandardPipeline.invoke(Unknown Source) at org.apache.catalina.core.ContainerBase.invoke(Unknown Source) at org.apache.catalina.connector.http.HttpProcessor.process(Unknown Source) at org.apache.catalina.connector.http.HttpProcessor.run(Unknown Source) at java.lang.Thread.run(Thread.java:484) tst.css: .slogan { font-family: Arial, Helvetica, sans-serif; font-size: 15px; color: #338833; font-weight: bold; background-color : transparent; } tst.js: script type=text/javascript language=JavaScript /script
TC 4.0 - IllegalStateException: Cannot create a session after the response has been committed
I'm trying to get OpenSymphony Sitemesh 1.2 running under Tomcat 4.0. I've tried beta 7 and dev beta 8. Anyway, I'm receiving the following exception: java.lang.IllegalStateException: Cannot create a session after the response has been committed at org.apache.catalina.connector.HttpRequestBase.doGetSession(HttpRequestBase.j ava:1104) at org.apache.catalina.connector.HttpRequestBase.getSession(HttpRequestBase.jav a:1064) at org.apache.catalina.connector.HttpRequestFacade.getSession(HttpRequestFacade .java:209) at org.apache.catalina.connector.HttpRequestFacade.getSession(HttpRequestFacade .java:218) at javax.servlet.http.HttpServletRequestWrapper.getSession(HttpServletRequestWr apper.java:268) at org.apache.jasper.runtime.PageContextImpl._initialize(PageContextImpl.java:1 38) at org.apache.jasper.runtime.PageContextImpl.initialize(PageContextImpl.java:11 4) at org.apache.jasper.runtime.JspFactoryImpl.internalGetPageContext(JspFactoryIm pl.java:175) at org.apache.jasper.runtime.JspFactoryImpl.getPageContext(JspFactoryImpl.java: 154) at org.apache.jsp._0002fdecorators_0002fmain_jsp._jspService(_0002fdecorators_0 002fmain_jsp.java:45) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.ja va:201) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:381) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:458) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher. java:672) at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatch er.java:563) at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher .java:486) at com.sitemesh.filter.PageFilter.applyDecorator(PageFilter.java:192) at com.sitemesh.filter.PageFilter.doFilter(PageFilter.java:114) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application FilterChain.java:213) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh ain.java:193) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja va:243) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5 66) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja va:215) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5 66) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943) at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2314) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164 ) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5 66) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:462) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5 64) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java :163) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5 66) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943) at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java: 1000) at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1093 ) at java.lang.Thread.run(Thread.java:484) Opening up the Tomcat /work directory, I'm able to look at the servlet code generated by Tomcat from the JSP. (_0002fdecorators_0002fmain_jsp.java:45) snip (43) _jspxFactory = JspFactory.getDefaultFactory(); (44) response.setContentType(text/html;charset=ISO-8859-1); (45) pageContext = _jspxFactory.getPageContext(this, request, response,, true, 8192, true); /snip I understand that once the response has been committed, you can't forward or redirect it. But what's going on here? Why is _jspxFactory.getPageContext(...) throwing this exception? This code is essentially right at the beginning of the servlet, before it even gets to JSP content. How do I tell Tomcat not to generate the
Re: TC 4.0 - IllegalStateException: Cannot create a session afterthe response has been committed
See below. On Wed, 22 Aug 2001, Blanchard Andrew H (CPOCEUR) wrote: I'm trying to get OpenSymphony Sitemesh 1.2 running under Tomcat 4.0. I've tried beta 7 and dev beta 8. Anyway, I'm receiving the following exception: java.lang.IllegalStateException: Cannot create a session after the response has been committed at org.apache.catalina.connector.HttpRequestBase.doGetSession(HttpRequestBase.j ava:1104) at org.apache.catalina.connector.HttpRequestBase.getSession(HttpRequestBase.jav a:1064) at org.apache.catalina.connector.HttpRequestFacade.getSession(HttpRequestFacade .java:209) at org.apache.catalina.connector.HttpRequestFacade.getSession(HttpRequestFacade .java:218) at javax.servlet.http.HttpServletRequestWrapper.getSession(HttpServletRequestWr apper.java:268) at org.apache.jasper.runtime.PageContextImpl._initialize(PageContextImpl.java:1 38) at org.apache.jasper.runtime.PageContextImpl.initialize(PageContextImpl.java:11 4) at org.apache.jasper.runtime.JspFactoryImpl.internalGetPageContext(JspFactoryIm pl.java:175) at org.apache.jasper.runtime.JspFactoryImpl.getPageContext(JspFactoryImpl.java: 154) at org.apache.jsp._0002fdecorators_0002fmain_jsp._jspService(_0002fdecorators_0 002fmain_jsp.java:45) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.ja va:201) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:381) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:458) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher. java:672) at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatch er.java:563) at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher .java:486) at com.sitemesh.filter.PageFilter.applyDecorator(PageFilter.java:192) at com.sitemesh.filter.PageFilter.doFilter(PageFilter.java:114) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application FilterChain.java:213) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh ain.java:193) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja va:243) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5 66) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja va:215) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5 66) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943) at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2314) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164 ) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5 66) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:462) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5 64) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java :163) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5 66) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943) at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java: 1000) at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1093 ) at java.lang.Thread.run(Thread.java:484) Opening up the Tomcat /work directory, I'm able to look at the servlet code generated by Tomcat from the JSP. (_0002fdecorators_0002fmain_jsp.java:45) snip (43) _jspxFactory = JspFactory.getDefaultFactory(); (44) response.setContentType(text/html;charset=ISO-8859-1); (45) pageContext = _jspxFactory.getPageContext(this, request, response,, true, 8192, true); /snip I understand that once the response has been committed, you can't forward or redirect it. But what's going on here? Why is _jspxFactory.getPageContext(...) throwing this exception? This code is essentially right at the
IllegalStateException with IBM
Hi All, I changed the jdk on my Tomcat today to use IBM instead of sun jdk. BUt since then I am getting this exception IllegalStateException in: R( + /myjsp.jsp + null) Cannot forward as OutputStream or Writer has already been obtained I am not using any includes or forwards in my jsp page. I am using RequestDispatcher in the servlet to forward the request to the corresponding page. Is this is a bug in IBM or something that I might be doing wrong. Please help Thanks -- Manish Poddar Software Engineer Paycom.net 310-827-5880 x 327 818-415-7447 (m)
IllegalStateException: Can't happen
I know this is a repeat. The archives and FAQ offer explanations, but not much help with eliminating this intermittent error. I'm using Tomcat 3.2.1 on WinXP Pro RC2 with MS IE6. Should I move on to Tomcat 3.2.3 or 4.0? Will that help? As noted previously, stopping and restarting tomcat makes the problem go away for awhile, until I make some change to a servlet. Although I have no way of knowing for sure, I hope it's not WinXP. So far, the beta and RC1 haven't been a problem. -- Terry Westley [EMAIL PROTECTED] -- Error: 500 Location: /sigada2001/index.html Internal Servlet Error: java.lang.IllegalStateException: Can't happen - classname is null, who added this ? at org.apache.tomcat.core.ServletWrapper.loadServlet(ServletWrapper.java:261) at org.apache.tomcat.core.ServletWrapper.init(ServletWrapper.java:289) at org.apache.tomcat.core.Handler.service(Handler.java:254) at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372) at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:797) at org.apache.tomcat.core.ContextManager.service(ContextManager.java:743) at org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java:210) at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416) at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:498) at java.lang.Thread.run(Thread.java:484)
IllegalStateException - tomcat 4
Hello, I have searched archives and have seen similar discussions, but could not really find an answer. I am developing a software on top of Servlet API 2.3 so I do need to use Tomcat at least for now. I tried to create a very simplified test case. I was able to reproduce a part of the problem so far, so that I can move forward. I am getting the following exception: java.lang.IllegalStateException: Cannot forward after response has been committed at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatch er.java:245) at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher .java:236) at org.apache.catalina.servlets.InvokerServlet.serveRequest(InvokerServlet.java :386) at org.apache.catalina.servlets.InvokerServlet.doGet(InvokerServlet.java:144) at javax.servlet.http.HttpServlet.service(HttpServlet.java:740) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher. java:573) at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatch er.java:483) at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher .java:388) at _0002ffirst_0002ejspfirst_jsp_28._jspService(_0002ffirst_0002ejspfirst_jsp_2 8.java:57) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.ja va:184) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:328) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:407) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh ain.java:215) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja va:251) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:977) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja va:196) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:977) at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2041) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:161 ) at org.apache.catalina.valves.ValveBase.invokeNext(ValveBase.java:242) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:414) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:975) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java :159) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:977) at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java: 818) at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:897) at java.lang.Thread.run(Thread.java:484) This problem happens when I try to include a servlet from a jsp page: H1First JSP/H1 % out.flush(); //RequestDispatcher d = request.getRequestDispatcher("/second.jsp"); RequestDispatcher d = request.getRequestDispatcher("/servlet/includetest.secondservlet"); d.include(request, response); % The servlet itself can be empty or can simply print out something with: resp.getWriter().println("look ma, i am here."); If I try to include /second.jsp - it works without the exception. It fails only for the servlet. By "failing" I mean that it generates an exception in the log the first time I try to execute my jsp file after Tomcat was restarted. After that it just works fine. It also works if I remove "flush()" - but then the output of the servlet comes before the output of jsp file. Another interesting thing: the test case works in ServletExcec. I read the spec - it says that there are limitations with "forward", but "include" should be just fine. Another question is if you take a look at the stack - it calls "include" and after that it calls "forward" where it fails - any idea why? Thank you, Andrey Akselrod, Senior Software Architect [EMAIL PROTECTED] == RUNTIME TECHNOLOGIES www.runtime.com 515 Greenwich Street, 2nd Floor T.212.462.2800.X.104 New York, New York 10013F.212.462.1074 == - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]