JaasSecurityManager.getPrincipal() does not check for empty domainCache. This method is called, for example, when JAAS is used from web layer.
Trivial fix, add in the start of the method: if( domainCache == null ) return principal;