Friday, September 5, 2014

EXP 7: java.io.NotSerializableException: com.sun.faces.context.FacesContextImpl

Problem
Get exception java.io.NotSerializableException: com.sun.faces.context.FacesContextImpl when deploy application in cluster

Cause
FacesContext implement should be use as FacesContext.getCurretntInstance() for all case. Dont use any variable e.g:

ExternalContext ec = FacesContext.getCurrentInstance().getExternalContext();
ec.redirect(url);

Solution
Check all FacesContext implementations, using FacesContext.getCurrentInstance() instead.

Wrong way:
ExternalContext ec = FacesContext.getCurrentInstance().getExternalContext();
ec.redirect(url);

Right way:
FacesContext.getCurrentInstance().getExternalContext().redirect(url);

No comments:

Post a Comment