Hi Mark,

I applied your advice. I added a directive to my error page, so it wont
create a session variable, and therefore won't try to create a session if it
does exist (<%@ page session="false"%>).
Well, IT WORKED! I got rid of the "java.lang.IllegalStateException: Cannot
create a session after the response has been committed" exception, which I
have seen in my log for months or maybe years!

Now the previous thing that went wrong is able to show its details in the
log. What is that? A Struts tag that tries to output the content of a bean
that is not present even though it should (this is the Struts tag:
<bean:write name="TEXT-NoteNoShippingFees"/>).
That bean should always be present, because it is created in the previous
Struts action. How can it be missing SOMETIMES, if it is not the only bean
that is being created in the previous action, and others of these beans that
are created in the action are present in the page? I guess it has something
to do with the buffer that gets full sometimes, or am I wrong? What do you
think?

In fact, I have had LOTs of problems with beans that "dissappear" even
though they should be present because they were created in the previous
actions. I have been dealing with these "randomic" problem for YEARS, and I
applied just a patch for that ("If the bean is not present, redirect to the
home page instead of showing an error message and dumping a trace in the
log").  That was just a workaround, and not a clean solution. I will try now
to use a buffer with 16K, to see if that will solve this.

Brian


   

> -----Original Message-----
> From: Mark Thomas [mailto:ma...@apache.org]
> Sent: Thursday, September 23, 2010 02:51 PM
> To: Tomcat Users List
> Subject: Re: In org.apache.catalina.connector.Request.doGetSession,
> java.lang.IllegalStateException: Cannot create a session after the
response
> has been committed
> 
> On 23/09/2010 12:01, Brian wrote:
> > Thanks for the "commited" explanation, but I still have a doubt: Where
> > in my code do I commit? I don't do it explicitly, so it is happening
> > at some point automatically but I don't know exactly where/when. If a
> > full buffer is not the cause, what is it for the commit to happen? In
> > which method/class does it happen?
> 
> As soon as the buffer is full or you flush the response.
> 
> > I will raise the 8K capacity in the buffer, just in case that is the
> > problem. That would explain why this problem appears to be "randomic".
> > If just some pages are too big, that would make the buffer to be full,
> > and then everything in the sequence you described would happen.
> >
> > I don't explicitly disable the session creation in my JSPs, so that is
> > not the problem. I don't call any "flushing" method either.
> 
> You need to explicitly disable session generation in your error JSP.
> That will ensure the sequence never happens.
> 
> > It is clear that something goes wrong in my "ProductsForModel.jps"
> > page (actually, in the java code generated for it), so an Exception is
> > being thrown and " PageContextImpl.handlePageException()" takes care
> > of it. But what exception? Is it the "
> > java.lang.IllegalStateException: Cannot create a session after the
response
> has been committed"? Or is it another one?
> 
> Yep, the broken error JSP is hiding the exception. Another option is to
remove
> the error handling JSPs.
> 
> Mark
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to