Reputation: 217
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?
Upvotes: 2
Views: 1000
Reputation: 1723
The solution is to inject the beans into the ExceptionHandlerFactory
and pass them to the ExceptionHandlerWrapper
by manually calling setters or adding another constructor parameter to it. Tested on Websphere 9.0 with JEE 7.
Upvotes: 0
Reputation: 1
You need inject o CustomExceptionHandler in then CustomExceptionHandlerFactory. Only then then the injections in CustomExceptionHandler will work
Upvotes: 0