On 03/06/2016 22:08, Steffen Heil (Mailinglisten) wrote:
> Hi
> 
> 
>>  throw new ServletException();
> 
> That was the difference. I threw a IllegalStateException(), so tomcat sent 
> "0\r\n".
> I changed my code to throw a ServletException() and now it works.
> Thanks for that.
> 
> 
> One very little thing left: Is there a way to suppress the logged exception:

It is a dirty Tomcat specific trick that will only work as long as the
code is the way it is but if you throw a ClientAbortException wrapped in
a ServletException you shouldn't see that log message.


> Jun 03, 2016 11:00:18 PM org.apache.catalina.core.StandardWrapperValve invoke
> SCHWERWIEGEND: Servlet.service() for servlet [Stream] in context with path [] 
> threw exception [null] with root cause
> javax.servlet.ServletException

<snip/>

> BTW: Why does it say "exception [null]"?

Because the exception was created with a null message.

> As I regard closing a connection a valid result of processing a request, I 
> would have expected a way to cleanly terminate a connection without logging a 
> severe exception.

The general expectation is that the connection is only closed if the
container code encounters an error and the typical cause for that
(ClientAbortException) doesn't generate the error. Anything else is
unexpected and triggers the logging.

The Servlet specification didn't anticipate an application being in a
position to decide to forcibly close the connection.

Mark


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

Reply via email to