2

I'm currently able to catch all exceptions with and a custom exception handler like described here:

JSF 2 Global exception handling, navigation to error page not happening

I'm making extensive use of CDI injection and wan't to call methods for email sending and error logging based on some database lookups. Everything is implemented in CDI Beans and I'm not able to call them within my exception handler. Do you know any way to accomplish calling them or are there any workarounds?

Community
  • 1
  • 1
ManuPanu
  • 217
  • 1
  • 3
  • 12
  • You should be able to access your CDI beans within your handler; CDI, in theory, permits injection almost anywhere. Have you tried to `@Inject` your resources into your handler? – kolossus Apr 05 '15 at 17:04
  • Have you got it working? I am facing the same issue. – Vishakha Oct 20 '16 at 05:52

2 Answers2

0

Deltaspike offers something that may help you accomplish this:

http://deltaspike.apache.org/documentation/jsf.html#_intergration_with_exception_control_from_deltaspike_0_6

faissalb
  • 1,739
  • 1
  • 12
  • 14
  • 1
    Link-only answers are not the best. It's better to post excerpts of the content here, or explain the solution. – kolossus Apr 05 '15 at 17:01
0

You need inject o CustomExceptionHandler in then CustomExceptionHandlerFactory. Only then then the injections in CustomExceptionHandler will work