0

I am new to JBoss Seam. I have been having issues with a small project am working on. The project has some errors and unfortunately for me I cannot find out the exact cause of the errors. I get a javax.servlet.ServletException. Please could someone tell me how to add custom filters so that I would be able to trap errors properly.

skaffman
  • 398,947
  • 96
  • 818
  • 769
Yanki Twizzy
  • 7,771
  • 8
  • 41
  • 68

1 Answers1

2

If you want to trap all synchronous exceptions happening in Seam, you extend the Exceptions class in Seam.

@Name("org.jboss.seam.exception.exceptions")
@Scope(ScopeType.APPLICATION)
@Install(precedence = Install.APPLICATION)
@BypassInterceptors
@Transactional
public class ExceptionHandler extends Exceptions {

    private static final LogProvider log = Logging.getLogProvider(ExceptionHandler.class);

    public void handle(Exception ex) throws Exception {
         //Here you can do whatever you want with the exception
         log.error("Exception occurred : " + ex.getMessage());
         super.handle(ex);
    }
Shervin Asgari
  • 23,901
  • 30
  • 103
  • 143