I have about 3 apps in glassfish-4 using SingleSignOn for security and a 4th app for 'Access Control' where all the users for all the apps login and get redirected to any of the apps the user has access to. Everything has been working perfectly until now that i need to add a 5th app. And the 5th app refused to work with the others. here is the code snippet i used in the first in all the apps:
@Named
@SessionScoped
public class SecurityController
// unnecessary codes ommitted
String email = FacesContext.getCurrentInstance().getExternalContext().getRemoteUser();
if(email==null){
FacesContext.getCurrentInstance().getExternalContext()
.redirect("http://localhost:8080/AccessControl/login.xhtml")
}
This has been working for me in all the first 3 apps but wouldnt work in this last one. Am using standard Java EE 6 with primefaces 5.0.
Here is the error i get:
Warning: Servlet.service() for servlet Faces Servlet threw exception
java.lang.NullPointerException
at com.sun.faces.context.flash.ELFlash.doLastPhaseActions(ELFlash.java:644)
at com.sun.faces.context.flash.ELFlash.doPostPhaseActions(ELFlash.java:582)
at com.sun.faces.context.ExternalContextImpl.doLastPhaseActions(ExternalContextImpl.java:1081)
at com.sun.faces.context.ExternalContextImpl.redirect(ExternalContextImpl.java:643)
Any suggestion will be greatly appreciated as this is delaying a long due move to production. Thanks