FacesContext « Exception « JSF Q&A





1. NullpointerException in getExternalContext in FacesContext    stackoverflow.com

I tried to get external context from FacesContext as followed and got NullPointerException:

ExternalContext context = FacesContext.getCurrentInstance().getExternalContext();
What could possibly cause the problem?

2. Error of cannot find FacesContext    coderanch.com