7 Replies Latest reply on Dec 22, 2005 12:05 PM by Jobby Joseph

    Please help --  'Failed to create sec mgr'

    Jobby Joseph Newbie

      Hi Gurus,
      I have a real bad issue, don't know how to solve the issue.
      I am actually using the JAAS security for my application. The application deploys well (all the EJB's and the services). But when i tries to log into my application i get an error 'Failed to create sec mgr'.

      excerpt from My login-config.xml
      --------------------------------------



      <application-policy name = "compliancepro">

      <login-module code = "org.jboss.security.auth.spi.DatabaseServerLoginModule" flag = "required">
      <module-option name = "dsJndiName">java:/DefaultDataSource</module-option>
      <module-option name = "principalsQuery">Select password from Users where username = ? and enabled = 1</module-option>
      <module-option name = "rolesQuery">Select System_Role.roles, 'Roles' From User_Role, System_Role, Users Where User_Role.Roles = System_Role.System_Role_Key AND User_Role.USERS_KEY = Users.USERS_KEY AND Users.username = ?</module-option>
      <module-option name = "unauthenticatedIdentity">everyone</module-option>
      </login-module>

      </application-policy>

      <!-- Used by clients within the application server VM such as
      mbeans and servlets that access EJBs.
      -->
      <application-policy name = "client-login">

      <login-module code = "org.jboss.security.ClientLoginModule"
      flag = "required">
      </login-module>

      </application-policy>

      <!-- Security domain for JBossMQ -->
      <application-policy name = "jbossmq">

      <login-module code = "org.jboss.security.auth.spi.DatabaseServerLoginModule"
      flag = "required">
      <module-option name = "unauthenticatedIdentity">guest</module-option>
      <module-option name = "dsJndiName">java:/DefaultDS</module-option>
      <module-option name = "principalsQuery">SELECT PASSWD FROM JMS_USERS WHERE USERID=?</module-option>
      <module-option name = "rolesQuery">SELECT ROLEID, 'Roles' FROM JMS_ROLES WHERE USERID=?</module-option>
      </login-module>

      </application-policy>

      The stack trace that i am getting is
      ---------------------------------------
      14:14:59,244 INFO [STDOUT] scl:
      14:14:59,291 ERROR [JaasSecurityManagerService] Failed to create sec mgr
      java.lang.NullPointerException
      at org.jboss.security.plugins.JaasSecurityManagerService.newSecurityDomainCtx(JaasSecurityManagerService.java:490)
      at org.jboss.security.plugins.JaasSecurityManagerService.lookupSecurityDomain(JaasSecurityManagerService.java:470)
      at org.jboss.security.plugins.JaasSecurityManagerService.access$200(JaasSecurityManagerService.java:64)
      at org.jboss.security.plugins.JaasSecurityManagerService$SecurityDomainObjectFactory.invoke(JaasSecurityManagerService.java:549)
      at $Proxy1457.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(InitialContext.java:351)
      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.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)
      14:14:59,291 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.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)
      Caused by: javax.naming.NamingException: Failed to create sec mgr:null
      at org.jboss.security.plugins.JaasSecurityManagerService.newSecurityDomainCtx(JaasSecurityManagerService.java:503)
      at org.jboss.security.plugins.JaasSecurityManagerService.lookupSecurityDomain(JaasSecurityManagerService.java:470)
      at org.jboss.security.plugins.JaasSecurityManagerService.access$200(JaasSecurityManagerService.java:64)
      at org.jboss.security.plugins.JaasSecurityManagerService$SecurityDomainObjectFactory.invoke(JaasSecurityManagerService.java:549)
      at $Proxy1457.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(InitialContext.java:351)
      at org.jnp.interfaces.NamingContext.resolveLink(NamingContext.java:1046)
      ... 15 more
      14:14:59,322 INFO [STDOUT] policy: getPermissions:
      PD CodeSource: (file:/C:/jboss-4.0.2/server/default/work/jboss.web/localhost/compliancepro/ <no signer certificates>)
      PD ClassLoader: org.apache.jasper.servlet.JasperLoader@b49448
      PD Principals: <no principals>
      14:14:59,322 INFO [STDOUT] policy: evaluate codesources:
      Policy CodeSource: (file:/C:/jdk1.5.0_02/jre/lib/ext/* <no signer certificates>)
      Active CodeSource: (file:/C:/jboss-4.0.2/server/default/work/jboss.web/localhost/compliancepro/ <no signer certificates>)
      14:14:59,322 INFO [STDOUT] policy: evaluation (codesource) failed
      14:14:59,322 INFO [STDOUT] policy: evaluate codesources:
      Policy CodeSource: (null <no signer certificates>)
      Active CodeSource: (file:/C:/jboss-4.0.2/server/default/work/jboss.web/localhost/compliancepro/ <no signer certificates>)
      14:14:59,322 INFO [STDOUT] policy: evaluate principals:
      Policy Principals: []
      Active Principals: []
      14:14:59,322 INFO [STDOUT] policy: evaluation (codesource/principals) passed
      14:14:59,322 INFO [STDOUT] policy: granting (java.lang.RuntimePermission stopThread)
      14:14:59,338 INFO [STDOUT] policy: granting (java.net.SocketPermission localhost:1024- listen,resolve)
      14:14:59,338 INFO [STDOUT] policy: granting (java.util.PropertyPermission java.version read)
      14:14:59,338 INFO [STDOUT] policy: granting (java.util.PropertyPermission java.vendor read)
      14:14:59,338 INFO [STDOUT] policy: granting (java.util.PropertyPermission java.vendor.url read)
      14:14:59,338 INFO [STDOUT] policy: granting (java.util.PropertyPermission java.class.version read)
      14:14:59,338 INFO [STDOUT] policy: granting (java.util.PropertyPermission os.name read)

      I also enabled debugging in java.security package, but that did not help me much.

      Can someone please suggest what is missing here and how to fix this.
      Note: i am using JBoss 4.0.2 and Java 1.5

      Thanks in advance,
      Jobby