Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
103 views
in Technique[技术] by (71.8m points)

java - 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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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;
    }
}

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...