Sunday, December 09, 2012

Handling JSF Exceptions in CDI based applications

If jsf and cdi are used in an application, jsf lifecycle methods that aborts the jsf lifecycle must not be called in jsf phase listeners.

CDI integrated with JSF using a JSF phase listener, resources such as conversation context are reseved by CDI in beforephase method that called in restore view phase. Also CDI resources released in afterPhase method of phase listener during render response phase. When you reach to render response phase resources released unconditionally  by CDI. 
If we call methods such as responseComplete that aborts the calling of afterPhase methods, resources released in after phase methods is not released and CDI resource locks unreleased . You may encounter with ConversationBusyException during the next request.