title: JAAS Error: Login failed
body: <p>i'm building some restful webservices and try to secure them by using JAAS.</p>
  
  <p>but i get the following error:</p>
  
  <pre><code> javax.servlet.ServletException: Login failed
  </code></pre>
  
  <p>I created a realm with the following attributes:</p>
  
  <pre><code>JAAS-Context: jdbcDigestRealm
  DIGEST-Algorithm: SHA-512
  Encoding: Hex
  password encryption: none
  </code></pre>
  
  <p>I try to log in by using HttpServletRequest:</p>
  
  <pre><code>request.login(email, password); //email = test@test.tld, password=&lt;SHA512HEX('testPasswprd')&gt;
  </code></pre>
  
  <p>Here is the StackTrace:</p>
  
  <pre><code>WARNING:   WEB9102: Web Login Failed: com.sun.enterprise.security.auth.login.common.LoginException: Login failed: null
  SEVERE:   javax.servlet.ServletException: Login failed
  at org.apache.catalina.authenticator.AuthenticatorBase.doLogin(AuthenticatorBase.java:959)
  at org.apache.catalina.authenticator.AuthenticatorBase.login(AuthenticatorBase.java:939)
  at org.apache.catalina.connector.Request.login(Request.java:2245)
  at org.apache.catalina.connector.Request.login(Request.java:2224)
  at org.apache.catalina.connector.RequestFacade.login(RequestFacade.java:1113)
  </code></pre>
  
  <p>Do you have some ideas?</p>
  
  <hr>
  
  <p>EDIT:</p>
  
  <p>Sometimes I get a NullPointerException at</p>
  
  <pre><code>request.login(email, password); //both variables and request are set.
  
  
  WARNING:   StandardWrapperValve[de.AuthTest.core.ApplicationConfig]: Servlet.service() for servlet de.AuthTest.core.ApplicationConfig threw exception
  java.lang.NullPointerException
  at org.apache.catalina.connector.Request.login(Request.java:2229)
  at org.apache.catalina.connector.Request.login(Request.java:2224)
  at org.apache.catalina.connector.RequestFacade.login(RequestFacade.java:1113)
  </code></pre>