3 Replies Latest reply on Mar 9, 2009 11:23 AM by Erik Lindquist

    NPE in GenericPrincipal

    Erik Lindquist Newbie

      I'm trying implement SSO and I'm having some trouble. I've been dealing with most of it but now I've got this:

      01:00:44,021 ERROR [JBossWebRealm] Error during authenticate
      java.lang.NullPointerException
      at java.util.Arrays.mergeSort(Arrays.java:1144)
      at java.util.Arrays.mergeSort(Arrays.java:1155)
      at java.util.Arrays.sort(Arrays.java:1079)
      at org.apache.catalina.realm.GenericPrincipal.(GenericPrincipal.java:96)
      at org.jboss.web.tomcat.security.JBossGenericPrincipal.(JBossGenericPrincipal.java:71)
      at org.jboss.web.tomcat.security.JBossWebRealm.getCachingPrincipal(JBossWebRealm.java:675)
      at org.jboss.web.tomcat.security.JBossWebRealm.authenticate(JBossWebRealm.java:409)
      at org.jboss.web.tomcat.security.login.WebAuthentication.login(WebAuthentication.java:93)

      ... rest of trace truncated.


      The GenericPrincipal code looks like this around line 96:

       92 if (roles != null) {
       93 this.roles = new String[roles.size()];
       94 this.roles = (String[]) roles.toArray(this.roles);
       95 if (this.roles.length > 0)
       96 Arrays.sort(this.roles);
       97 }
      


      Does this mean that one of my Roles is null? Where are the roles coming from? There are 2 places where I can specify roles that I know of. One is in the LoginProvider that I wrote. The other is in sso-cfg.xml. The LoginProvider will return at least "Other" if no role exists for an otherwise authenticatable user.

      I'm using UsernameAndPasswordLoginModule.

      Can anyone help please? thanks.