2 Replies Latest reply on Dec 21, 2005 3:08 PM by Jobby Joseph

    j_security_check and DatabaseServerLoginModule don't work to

    Pavnit Bhatia Newbie

      Hello all,

      I guess I will try again to put the complete error message at the end of this post.


      I am trying to do simple authentication using j_security_check and then using DatabaseServerLoginModule in my login-config.xml.

      For some reason it gives me the below error.

      But instead of using j_security_check if I redirect to my struts action class and then put the following logic then it authenticates well but then I loose the ability to use getPrincipal(), getRemoteUser() ... etc:

      SecurityAssociationHandler handler = new SecurityAssociationHandler();
      String j_username = request.getParameter("j_username");
      SimplePrincipal user = new SimplePrincipal(j_username);
      handler.setSecurityInfo(user, request.getParameter("j_password").toCharArray());

      LoginContext loginContext = new LoginContext("ilocity-auth", (CallbackHandler)handler);
      loginContext.login();

      Subject subject = loginContext.getSubject();
      Set principals = subject.getPrincipals();
      principals.add(user);


      The same code runs well in Weblogic 7.0 sp1 with j_security_check and custom MBEAN.



      PLEASE HELP. Desperately seeking help!!


      *********** ERROR using j_security_check with DatabaseServerLoginModule ***************
      12:49:44,562 ERROR [JaasSecurityManagerService] Failed to create sec mgr
      java.lang.NullPointerException
      at org.jboss.security.plugins.JaasSecurityManagerService.newSecurityDomainCtx(JaasSecurityManagerService.java:534)
      at org.jboss.security.plugins.JaasSecurityManagerService.lookupSecurityDomain(JaasSecurityManagerService.java:514)
      at org.jboss.security.plugins.JaasSecurityManagerService.access$200(JaasSecurityManagerService.java:66)
      at org.jboss.security.plugins.JaasSecurityManagerService$SecurityDomainObjectFactory.invoke(JaasSecurityManagerService.java:611)
      at $Proxy51.lookup(Unknown Source)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:701)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:572)
      at javax.naming.InitialContext.lookup(Unknown Source)
      at org.jnp.interfaces.NamingContext.resolveLink(NamingContext.java:1046)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:685)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:572)
      at org.jboss.web.tomcat.security.JBossSecurityMgrRealm.authenticate(JBossSecurityMgrRealm.java:227)
      at org.apache.catalina.authenticator.FormAuthenticator.authenticate(FormAuthenticator.java:256)
      at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:391)
      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.authenticator.SingleSignOn.invoke(SingleSignOn.java:365)
      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(Unknown Source)
      12:49:44,562 ERROR [JBossSecurityMgrRealm] Error during authenticate
      javax.naming.NamingException: Could not dereference object [Root exception is javax.naming.NamingException: Failed to create sec mgr:null]
      at org.jnp.interfaces.NamingContext.resolveLink(NamingContext.java:1052)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:685)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:572)
      at org.jboss.web.tomcat.security.JBossSecurityMgrRealm.authenticate(JBossSecurityMgrRealm.java:227)
      at org.apache.catalina.authenticator.FormAuthenticator.authenticate(FormAuthenticator.java:256)
      at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:391)
      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.authenticator.SingleSignOn.invoke(SingleSignOn.java:365)
      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(Unknown Source)
      Caused by: javax.naming.NamingException: Failed to create sec mgr:null
      at org.jboss.security.plugins.JaasSecurityManagerService.newSecurityDomainCtx(JaasSecurityManagerService.java:547)
      at org.jboss.security.plugins.JaasSecurityManagerService.lookupSecurityDomain(JaasSecurityManagerService.java:514)
      at org.jboss.security.plugins.JaasSecurityManagerService.access$200(JaasSecurityManagerService.java:66)
      at org.jboss.security.plugins.JaasSecurityManagerService$SecurityDomainObjectFactory.invoke(JaasSecurityManagerService.java:611)
      at $Proxy51.lookup(Unknown Source)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:701)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:572)
      at javax.naming.InitialContext.lookup(Unknown Source)
      at org.jnp.interfaces.NamingContext.resolveLink(NamingContext.java:1046)
      ... 16 more