> -----Original Message-----
> From: Tom Davis [mailto:[EMAIL PROTECTED]
> Sent: Thursday, February 08, 2007 10:35 AM
> To: users@tomcat.apache.org
> Subject: IllegalStateException in Tomcat 5.5.X
> 
> Hi All.
> 
> I'm getting some intermittent exceptions from Tomcat with which I would
> appreciate some assistance.  I get an IllegalStateException from
> Tomcat.  This is not a unique error, though it looks like the
> circumstances causing it are.  We have a complex application, with
> multiple servlets and many JSPs.  The specific type of
> IllegalStateException is a TODO, and it usually occurs when we call
> sendError() on the HttpServletResponse object.  I know this sounds like
> the typical coding error, but we have checked very carefully and haven't
> found it.  We have looked through many of the posts on other occurrences
> of this exception, including the Tomcat documentation that describes its
> common causes. We've checked those method calls (e.g., getWriter() or
> getOutputStream() followed by a sendError() or similar call), and can't
> see any logical errors in the flow of code.
> 
> The exception only occurs when one specific servlet is active.  This
> servlet is a custom proxy, and behaves as an Http client to other
> servers.  Interestingly, the exception doesn't get thrown from the proxy
> servlet, it actually pops up in several of the other servlets.  We put
> in lots of debug statements and found that sometimes (approximately 20%
> of the time) the 'isCommitted()' method on the HttpServletResponse
> object indicates that the response is already committed *upon entry* to
> the proxy servlet!  But even when isCommitted() indicates true, it only
> occasionally leads to the exception occurring in the other servlets.
> 
> It seems that Tomcat is getting confused at the core by the proxy
> servlet - why else would the response appear to already be committed
> upon entry to our servlet.  Possibly this is due to the web client
> nature of the proxy servlet?  Or maybe a subtle bug somewhere in the
> proxy code that overwrites something internally in Tomcat?
> 
> We can avoid the IllegalStateException by not calling sendError if the
> response is committed, but either way the application doesn't behave
> properly.
> 
> Environment:  We get the same problem on in different environments,
> which strongly indicates it is specific to the Tomcat 5.5.X line:
> OS:  Windows 2000, Windows XP, AIX
> JVM:  1.4.2_12-b03 on Win32, J2RE 1.4.2 IBM AIX build ca142-20060824 (SR6)
> Tomcat:  5.5.7 and 5.5.20
> 
> The Tomcat FAQ lists *the most common* reasons for getting an
> IllegalStateException.  I think we need to go to the next level.  Does
> anyone know the more subtle reasons for getting this?

It's been said already, but I'll repeat it because I have been in exactly
this boat before.  One slip up in a refactoring exercise left one and only
one class member as static, which is fine until you put it under load, and
then everything gets confused quite quickly.  It is very likely to be a
concurrency problem lke non-Thread-Local request or session data stored in
the servlet class, or some static member(s) that shouldn't be static.

Tim

> 
> Thanks,
> Tom Davis
> 
> 
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to