javax.security.auth.login.LoginException: java.lang.NullPointerException

Spring JIRA | Aycan iRiCAN | 1 decade ago
  1. 0

    SEC-59: NullPointerException in JbossAcegiLoginModule

    GitHub | 1 decade ago | spring-issuemaster
    javax.security.auth.login.LoginException: java.lang.NullPointerException
  2. 0

    As written in reference documentation I tried to use an application-policy like this: <application-policy name = "core"> <authentication> <!-- reference doc says JbossSpringLoginModule but this was renamed in cvs --> <login-module code = "net.sf.acegisecurity.adapters.jboss.JbossAcegiLoginModule" flag = "required"> <module-option name = "singletonId">springRealm</module-option> <module-option name = "key">my_password</module-option> <module-option name = "authenticationManager">authenticationManager</module-option> </login-module> </authentication> </application-policy> I got NullPointerException, here is the log: 2005-09-26 17:25:42,433 INFO [net.sf.acegisecurity.adapters.jboss.JbossAcegiLoginModule] initializing jboss login module 2005-09-26 17:25:42,434 TRACE [org.jboss.security.plugins.JaasSecurityManager.core] Login failure javax.security.auth.login.LoginException: java.lang.NullPointerException at EDU.oswego.cs.dl.util.concurrent.ConcurrentReaderHashMap.hash(ConcurrentReaderHashMap.java:298) at EDU.oswego.cs.dl.util.concurrent.ConcurrentReaderHashMap.get(ConcurrentReaderHashMap.java:410) at org.jboss.mx.loading.RepositoryClassLoader.getResourceLocally(RepositoryClassLoader.java:197) at org.jboss.mx.loading.UnifiedLoaderRepository3.getResourceFromClassLoader(UnifiedLoaderRepository3.java:373) at org.jboss.mx.loading.UnifiedLoaderRepository3.getResource(UnifiedLoaderRepository3.java:288) at org.jboss.mx.loading.RepositoryClassLoader.getResource(RepositoryClassLoader.java:529) at java.lang.ClassLoader.getResource(ClassLoader.java:972) at org.apache.catalina.loader.WebappClassLoader.getResource(WebappClassLoader.java:1072) at net.sf.acegisecurity.adapters.jboss.JbossAcegiLoginModule.initialize(JbossAcegiLoginModule.java:100) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at javax.security.auth.login.LoginContext.invoke(LoginContext.java:756) at javax.security.auth.login.LoginContext.access$000(LoginContext.java:186) at javax.security.auth.login.LoginContext$4.run(LoginContext.java:683) at java.security.AccessController.doPrivileged(Native Method) at javax.security.auth.login.LoginContext.invokePriv(LoginContext.java:680) at javax.security.auth.login.LoginContext.login(LoginContext.java:579) at org.jboss.security.plugins.JaasSecurityManager.defaultLogin(JaasSecurityManager.java:572) at org.jboss.security.plugins.JaasSecurityManager.authenticate(JaasSecurityManager.java:506) at org.jboss.security.plugins.JaasSecurityManager.isValid(JaasSecurityManager.java:315) at org.jboss.web.tomcat.security.JBossSecurityMgrRealm.authenticate(JBossSecurityMgrRealm.java:230) at org.apache.catalina.authenticator.BasicAuthenticator.authenticate(BasicAuthenticator.java:181) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:446) at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:59) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744) at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527) at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112) at java.lang.Thread.run(Thread.java:595) at javax.security.auth.login.LoginContext.invoke(LoginContext.java:872) at javax.security.auth.login.LoginContext.access$000(LoginContext.java:186) at javax.security.auth.login.LoginContext$4.run(LoginContext.java:683) at java.security.AccessController.doPrivileged(Native Method) at javax.security.auth.login.LoginContext.invokePriv(LoginContext.java:680) at javax.security.auth.login.LoginContext.login(LoginContext.java:579) at org.jboss.security.plugins.JaasSecurityManager.defaultLogin(JaasSecurityManager.java:572) at org.jboss.security.plugins.JaasSecurityManager.authenticate(JaasSecurityManager.java:506) at org.jboss.security.plugins.JaasSecurityManager.isValid(JaasSecurityManager.java:315) at org.jboss.web.tomcat.security.JBossSecurityMgrRealm.authenticate(JBossSecurityMgrRealm.java:230) at org.apache.catalina.authenticator.BasicAuthenticator.authenticate(BasicAuthenticator.java:181) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:446) at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:59) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744) at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527) at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112) at java.lang.Thread.run(Thread.java:595) So I started to inspect the problem, then I realized that JbossAcegiLoginModule try to find appContextLocation even it doesn't defined. Here is the code from acegisecurity CVS: if (Thread.currentThread().getContextClassLoader().getResource(appContextLocation) == null) { if (super.log.isInfoEnabled()) { super.log.info("cannot locate " + appContextLocation); } throw new IllegalArgumentException("Cannot locate " + appContextLocation); } I think, this should be done when singletonId == null or "".equals(singletonId). Thank you.

    Spring JIRA | 1 decade ago | Aycan iRiCAN
    javax.security.auth.login.LoginException: java.lang.NullPointerException
  3. 0

    As written in reference documentation I tried to use an application-policy like this: <application-policy name = "core"> <authentication> <!-- reference doc says JbossSpringLoginModule but this was renamed in cvs --> <login-module code = "net.sf.acegisecurity.adapters.jboss.JbossAcegiLoginModule" flag = "required"> <module-option name = "singletonId">springRealm</module-option> <module-option name = "key">my_password</module-option> <module-option name = "authenticationManager">authenticationManager</module-option> </login-module> </authentication> </application-policy> I got NullPointerException, here is the log: 2005-09-26 17:25:42,433 INFO [net.sf.acegisecurity.adapters.jboss.JbossAcegiLoginModule] initializing jboss login module 2005-09-26 17:25:42,434 TRACE [org.jboss.security.plugins.JaasSecurityManager.core] Login failure javax.security.auth.login.LoginException: java.lang.NullPointerException at EDU.oswego.cs.dl.util.concurrent.ConcurrentReaderHashMap.hash(ConcurrentReaderHashMap.java:298) at EDU.oswego.cs.dl.util.concurrent.ConcurrentReaderHashMap.get(ConcurrentReaderHashMap.java:410) at org.jboss.mx.loading.RepositoryClassLoader.getResourceLocally(RepositoryClassLoader.java:197) at org.jboss.mx.loading.UnifiedLoaderRepository3.getResourceFromClassLoader(UnifiedLoaderRepository3.java:373) at org.jboss.mx.loading.UnifiedLoaderRepository3.getResource(UnifiedLoaderRepository3.java:288) at org.jboss.mx.loading.RepositoryClassLoader.getResource(RepositoryClassLoader.java:529) at java.lang.ClassLoader.getResource(ClassLoader.java:972) at org.apache.catalina.loader.WebappClassLoader.getResource(WebappClassLoader.java:1072) at net.sf.acegisecurity.adapters.jboss.JbossAcegiLoginModule.initialize(JbossAcegiLoginModule.java:100) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at javax.security.auth.login.LoginContext.invoke(LoginContext.java:756) at javax.security.auth.login.LoginContext.access$000(LoginContext.java:186) at javax.security.auth.login.LoginContext$4.run(LoginContext.java:683) at java.security.AccessController.doPrivileged(Native Method) at javax.security.auth.login.LoginContext.invokePriv(LoginContext.java:680) at javax.security.auth.login.LoginContext.login(LoginContext.java:579) at org.jboss.security.plugins.JaasSecurityManager.defaultLogin(JaasSecurityManager.java:572) at org.jboss.security.plugins.JaasSecurityManager.authenticate(JaasSecurityManager.java:506) at org.jboss.security.plugins.JaasSecurityManager.isValid(JaasSecurityManager.java:315) at org.jboss.web.tomcat.security.JBossSecurityMgrRealm.authenticate(JBossSecurityMgrRealm.java:230) at org.apache.catalina.authenticator.BasicAuthenticator.authenticate(BasicAuthenticator.java:181) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:446) at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:59) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744) at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527) at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112) at java.lang.Thread.run(Thread.java:595) at javax.security.auth.login.LoginContext.invoke(LoginContext.java:872) at javax.security.auth.login.LoginContext.access$000(LoginContext.java:186) at javax.security.auth.login.LoginContext$4.run(LoginContext.java:683) at java.security.AccessController.doPrivileged(Native Method) at javax.security.auth.login.LoginContext.invokePriv(LoginContext.java:680) at javax.security.auth.login.LoginContext.login(LoginContext.java:579) at org.jboss.security.plugins.JaasSecurityManager.defaultLogin(JaasSecurityManager.java:572) at org.jboss.security.plugins.JaasSecurityManager.authenticate(JaasSecurityManager.java:506) at org.jboss.security.plugins.JaasSecurityManager.isValid(JaasSecurityManager.java:315) at org.jboss.web.tomcat.security.JBossSecurityMgrRealm.authenticate(JBossSecurityMgrRealm.java:230) at org.apache.catalina.authenticator.BasicAuthenticator.authenticate(BasicAuthenticator.java:181) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:446) at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:59) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744) at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527) at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112) at java.lang.Thread.run(Thread.java:595) So I started to inspect the problem, then I realized that JbossAcegiLoginModule try to find appContextLocation even it doesn't defined. Here is the code from acegisecurity CVS: if (Thread.currentThread().getContextClassLoader().getResource(appContextLocation) == null) { if (super.log.isInfoEnabled()) { super.log.info("cannot locate " + appContextLocation); } throw new IllegalArgumentException("Cannot locate " + appContextLocation); } I think, this should be done when singletonId == null or "".equals(singletonId). Thank you.

    Spring JIRA | 1 decade ago | Aycan iRiCAN
    javax.security.auth.login.LoginException: java.lang.NullPointerException
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Java EE 6 on Glassfish 3.1 CallbackHandler throws NullPointerException

    Stack Overflow | 5 years ago | Rick-Rainer Ludwig
    javax.security.auth.login.LoginException: java.lang.NullPointerException

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. javax.security.auth.login.LoginException

      java.lang.NullPointerException

      at EDU.oswego.cs.dl.util.concurrent.ConcurrentReaderHashMap.hash()
    2. Dough Lea's util.concurrent package
      ConcurrentReaderHashMap.get
      1. EDU.oswego.cs.dl.util.concurrent.ConcurrentReaderHashMap.hash(ConcurrentReaderHashMap.java:298)
      2. EDU.oswego.cs.dl.util.concurrent.ConcurrentReaderHashMap.get(ConcurrentReaderHashMap.java:410)
      2 frames
    3. JBoss Application Server J2SE
      RepositoryClassLoader.getResource
      1. org.jboss.mx.loading.RepositoryClassLoader.getResourceLocally(RepositoryClassLoader.java:197)
      2. org.jboss.mx.loading.UnifiedLoaderRepository3.getResourceFromClassLoader(UnifiedLoaderRepository3.java:373)
      3. org.jboss.mx.loading.UnifiedLoaderRepository3.getResource(UnifiedLoaderRepository3.java:288)
      4. org.jboss.mx.loading.RepositoryClassLoader.getResource(RepositoryClassLoader.java:529)
      4 frames
    4. Java RT
      ClassLoader.getResource
      1. java.lang.ClassLoader.getResource(ClassLoader.java:972)
      1 frame
    5. Glassfish Core
      WebappClassLoader.getResource
      1. org.apache.catalina.loader.WebappClassLoader.getResource(WebappClassLoader.java:1072)
      1 frame