i'm trying to get the logged in user to show its informations in jsf index page which you need to be logged in to access it , i can't access the login page because the exception preventing the project from working, like the title says i'm getting nullpointer exception , i'm using spring 4 , java 7 .
Managed bean :
    @PostConstruct
public void init() {
    Object principal = SecurityContextHolder.getContext().getAuthentication().getPrincipal();
    if (principal instanceof UserDetails) {
       login = ((UserDetails)principal).getUsername();
    } else {
       login = principal.toString();
    }
web xml :
         <listener>
        <listener-class>
            org.springframework.web.context.ContextLoaderListener
        </listener-class>
      </listener>
      <listener>
        <listener-class>
            org.springframework.web.context.request.RequestContextListener
        </listener-class>
      </listener>
        <!-- CONTEXT  -->
            <context-param>
                    <param-name>contextConfigLocation</param-name>
                    <param-value>/WEB-INF/ApplicationContext.xml , /WEB-INF/spring-security.xml</param-value>
      
            </context-param>   
   <filter>
        <filter-name>springSecurityFilterChain</filter-name>
        <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
    </filter>
    <filter-mapping>
        <filter-name>springSecurityFilterChain</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>
Spring security xml :
  <http 
    authentication-manager-ref="jdbc-auth"
      use-expressions="true" >   
                      <intercept-url pattern="/loggedout.xhtml" access="permitAll" />     
            <intercept-url pattern="/login.xhtml" access="permitAll" />
            <intercept-url pattern="/denied.xhtml" access="isAuthenticated()" />             
            <intercept-url pattern="/member/**" access="isAuthenticated()" />
            <intercept-url pattern="/admin/**" access="Administrateur-portail" />  
               
             <form-login  login-page="/login.xhtml" login-processing-url="/j_spring_security_check"
              username-parameter="username" password-parameter="password" authentication-failure-url="/denied.xhtml" />
    <csrf disabled="true"/>
    </http>
