Win a copy of The Way of the Web Tester: A Beginner's Guide to Automating Tests this week in the Testing forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JSF 2.0 exception handling

N Ha
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I want to throw a custom exception "AppException" in my controller, where this AppException extends Exception. And to catch it in my CustomExceptionHandler.
The problem is that when I go to the CustomExceptionHandler, I get the exception as "FacesException" not "AppException "


public class DefaultExceptionHandlerFactory extends ExceptionHandlerFactory {
public ExceptionHandler getExceptionHandler() {
ExceptionHandler eh = new DefaultExceptionHandler(parent.getExceptionHandler());
return eh;

public class DefaultExceptionHandler extends ExceptionHandlerWrapper {
public void handle() throws FacesException {
Iterator i = getUnhandledExceptionQueuedEvents().iterator();
while (i.hasNext()) {
ExceptionQueuedEvent event = (ExceptionQueuedEvent);
ExceptionQueuedEventContext context =

//obtain throwable object
Throwable t = context.getException();

Any help?
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic