title: Identity.getCredentials throws NullPointerException
body: <p>I'm working on the front-end of a web application developed using JBoss seam. I'm encountering a <code>NullPointerException</code> at user login but I don't know how it happens. Here's a summary based from the log.</p>
  
  <p>When a user tries to login, the authenticate method in the LoginBean was executed</p>
  
  <pre><code>    public class LoginBean{
              //both from org.jboss.seam.security package
              @In
              private Credentials credentials
  
              @In
              private Identity identity
  
              public boolean authenticate(){
                      ...
  
                      //false
                      logger.info(identity.getCredential null? == " + identity.getCredential==null);
  
                      //this returns true
                      result = webAuthentication.login(credential.getUsername(), credential.getPassword());
  
                      return result;
              }
      }
  </code></pre>
  
  <p>I can still access the credentials attribute of the identity object in this code. After executing the authenticate, the log shows that a method from another class was executed.</p>
  
  <pre><code>    public class LoginControllerBean{
              @In 
              private Identity identity; //org.jboss.seam.security
  
              @Observer("org.jboss.seam.security.loginSuccessful")
              @Begin(join = true)
              public void updateSessionUserStats(){
                      //i can still see this in the log
                      logger.info("Login successful. updating sessionUserInfo....");
  
                      //throws NullPointerException  
                      logger.info("check identity.getCredential if null == " + identity.getCredential());
  
  
                      sessionUser = new SessionUser();
                      //if I remove the log above this call will throw NullPointerException                        
                      sessionUser.setUsername(identity.getCredentials().getUsername());
              }
  
      }
  </code></pre>
  
  <p>I assumed that the login was successful because the method with the <code>@Observer(...loginSuccessful)</code> annotation was executed right after authenticate.</p>
  
  <p>Both of the identity objects in the first and second class are injected by <code>@In annotation.</code>
  Why is the <code>identity.getCredentials() throws nullPointerException</code> on the second code while it is ok on the first code? What could be the cause of i<code>dentity.getCredentials() throwing nullPointerException?</code> Sorry if I cannot give more details on the problem. I can only access the front-end codes.Thanks.</p>