According to OmniFaces 1.6, you can extend it and override the logException() method, as shown below, to skip the stack trace for ViewExpiredException .
public class YourAjaxExceptionHandler extends FullAjaxExceptionHandler { public YourAjaxExceptionHandler(ExceptionHandler wrapped) { super(wrapped); } @Override protected void logException(FacesContext context, Throwable exception, String location, String message, Object... parameters) { if (exception instanceof ViewExpiredException) {
Create a factory around it:
public class YourAjaxExceptionHandlerFactory extends ExceptionHandlerFactory { private ExceptionHandlerFactory wrapped; public YourAjaxExceptionHandlerFactory(ExceptionHandlerFactory wrapped) { this.wrapped = wrapped; } @Override public ExceptionHandler getExceptionHandler() { return new YourAjaxExceptionHandler(getWrapped().getExceptionHandler()); } @Override public ExceptionHandlerFactory getWrapped() { return wrapped; } }
To run it, register it as a factory in faces-config.xml usual way (remember to remove the original registration for FullAjaxExceptionHandlerFactory ):
<factory> <exception-handler-factory>com.example.YourExceptionHandlerFactory</exception-handler-factory> </factory>
source share