2 Replies Latest reply on Feb 25, 2004 4:16 AM by martin0

    JNDI name of application-policy is not bound

    martin0

      Hi,

      I'm new to JAAS, but am using the JavaWorld JBoss JAAS paper to learn. I have the example from there working with JBoss 3.2.3.

      Now I'm trying to apply it in my own application. So far I just have a servlet I want to restrict. When I try to access a restricted resource, I get


      2004-02-25 09:07:39,874 ERROR [org.jboss.web.tomcat.security.JBossSecurityMgrRealm] Error during authenticate
      javax.naming.NamingException: Could not dereference object. Root exception is
      javax.naming.NameNotFoundException: Test not bound
      at org.jnp.server.NamingServer.getBinding(Ljava.lang.String;)Ljavax.naming.Binding;(NamingServer.java:495)
      at org.jnp.server.NamingServer.getBinding(Ljavax.naming.Name;)Ljavax.naming.Binding;(NamingServer.java:503)
      at org.jnp.server.NamingServer.getObject(Ljavax.naming.Name;)Ljava.lang.Object;(NamingServer.java:509)
      at org.jnp.server.NamingServer.lookup(Ljavax.naming.Name;)Ljava.lang.Object;(NamingServer.java:282)
      at org.jnp.interfaces.NamingContext.lookup(Ljavax.naming.Name;)Ljava.lang.Object;(NamingContext.java:528)
      at org.jnp.interfaces.NamingContext.lookup(Ljava.lang.String;)Ljava.lang.Object;(NamingContext.java:507)
      at javax.naming.InitialContext.lookup(Ljava.lang.String;)Ljava.lang.Object;(InitialContext.java:347)
      at org.jnp.interfaces.NamingContext.resolveLink(Ljava.lang.Object;Ljava.util.Hashtable;)Ljava.lang.Object;(NamingContext.java:964)
      at org.jnp.interfaces.NamingContext.lookup(Ljavax.naming.Name;)Ljava.lang.Object;(NamingContext.java:613)
      at org.jnp.interfaces.NamingContext.lookup(Ljava.lang.String;)Ljava.lang.Object;(NamingContext.java:507)
      at org.jboss.web.tomcat.security.JBossSecurityMgrRealm.authenticate(Ljava.lang.String;Ljava.lang.String;)Ljava.security.Principal;(JBossSecurityMgrRealm.java:276)
      at org.jboss.web.tomcat.tc4.authenticator.FormAuthenticator.authenticate(Lorg.apache.catalina.HttpRequest;Lorg.apache.catalina.HttpResponse;Lorg.apache.catalina.deploy.LoginConfig;)Z(FormAuthenticator.java:320)


      I can't see the jndi entry for my security-domain / application-policy in jmx-console /JNDIView java:namespace. However I believe my login-config.xml is correct:

      <application-policy name="Test">
      <authentication>
      <login-module code="org.jboss.security.auth.spi.DatabaseServerLoginModule" flag="required">
      <module-option name="dsJndiName">java:/testDS </module-option>
      <module-option name="principalsQuery">select pwd from T_ACCOUNT where userId=?</module-option>
      <module-option name="rolesQuery">select userRoles, roleGroup from T_ROLES where username=?</module-option>
      </login-module>
      </authentication>
      </application-policy>

      Am I right in thinking I should see the JNDI entry as long as the application policy is in place? I've got the security-domain in web.xml also set to Test.

      TIA
      Martin