FullAjaxExceptionHandler
should be able to handle it. Your particular problem is probably due to the fact that you have a relatively large page that overflows the default buffer size of Facelets with a size of 2 KB, and thus the answer is already committed at the point where the exception was thrown. When the response is complete, part of the response has already been sent to the client side. There is no way to return already sent bytes and submit a new response using the error page. You would have the same problem if not using ajax. Instead, an exception will be logged and the client will be stuck with a semi-processed page.
You might want to increase the default response buffer size to the size of your largest HTML response. Thus, the response will be generated and fully buffered in the server memory before the first byte is sent to the client side. You can set it using the javax.faces.FACELETS_BUFFER_SIZE
context parameter in web.xml
with the buffer size in bytes as a value. The following example sets it to 64K.
<context-param> <param-name>javax.faces.FACELETS_BUFFER_SIZE</param-name> <param-value>65535</param-value> </context-param>
You may want to set this in the development / testing environment only so that you can notice any errors on the viewing side, and the live environment can continue to use the default buffer size to save server memory.
source share