Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ClientAbortException at application deployed at jboss with IE8 browser

I am having following exception for application deployed at Jboss, Browser is IE8

2012-03-19 09:17:12,014 WARN  [org.apache.catalina.core.ContainerBase.jboss.web].         [localhost]] Exception Processing ErrorPage[errorCode=404, location=/internalError.jsp]
ClientAbortException:  java.net.SocketException: Broken pipe
    at org.apache.catalina.connector.OutputBuffer.doFlush(OutputBuffer.java:327)

It seems that browser closed the socket before server writes internalError.jsp to it. Please suggest how to solve it , or atleast how I can hide this exception.

Thanks Hikumar

like image 926
HKumar Avatar asked Mar 20 '12 14:03

HKumar


1 Answers

You cannot solve it. You cannot control whether the client will press Esc, or hastily click a different link, or close the browser, or have its machine crashed, etcetera, while your server is still handling the HTTP request/response.

You can "hide" it by a global filter (mapped on /*) which does something like this:

try {
    chain.doFilter(request, response);
}
catch (ClientAbortException e) {
    // Ignore.
}

This however brings a servletcontainer-specfic dependency in your code. The filter in question would result in NoClassDefFoundError on a servletcontainer of a different make which doesn't use Tomcat specific ClientAbortException. You might want to check the class simple name instead. Make use of the advantage that it's a subclass of IOException:

try {
    chain.doFilter(request, response);
}
catch (IOException e) {
    if (!e.getClass().getSimpleName().equals("ClientAbortException")) {
        throw e;
    }
}
like image 161
BalusC Avatar answered Oct 18 '22 17:10

BalusC