5 Replies Latest reply on Sep 19, 2001 10:36 PM by Scott Stark

    DatabaseServerLoginModule Can't Find DataSource

    Keith Teo Newbie

      Hi,

      I have actually tried to use DatabaseServerLoginModule, but it keeps throwing me the following exception :

      javax.security.auth.login.LoginException: javax.naming.NameNotFoundException: netlifePool not bound

      I am currently using netlifePool as my poolname for my beans.

      Using JNDIView action, I can see the following :

      java: Namespace
      + jaas (class: javax.naming.Context)
      + InstantDB (class: org.jboss.pool.jdbc.xa.XAPoolDataSource)
      + TransactionPropagationContextImporter (class: org.jboss.tm.TransactionPropagationContextImporter)
      + INVMTopicConnectionFactory (class: org.jbossmq.SpyTopicConnectionFactory)
      + MinervaSharedLocalCMFactory (class: org.jboss.pool.connector.jboss.MinervaSharedLocalCMFactory)
      + DefaultDS (class: org.jboss.pool.jdbc.xa.XAPoolDataSource)
      + MinervaXACMFactory (class: org.jboss.pool.connector.jboss.MinervaXACMFactory)
      + StdJMSPool (class: org.jboss.jms.asf.StdServerSessionPoolFactory)
      + TransactionManager (class: org.jboss.tm.TxManager)
      + TransactionPropagationContextExporter (class: org.jboss.tm.TransactionPropagationContextFactory)
      + INVMXAQueueConnectionFactory (class: org.jbossmq.SpyXAQueueConnectionFactory)
      + DefaultJMSProvider (class: org.jboss.jms.jndi.JBossMQProvider)
      + INVMXATopicConnectionFactory (class: org.jbossmq.SpyXATopicConnectionFactory)
      + Mail (class: javax.mail.Session)
      + SecurityProxyFactory (class: org.jboss.security.SubjectSecurityProxyFactory)
      + comp (class: javax.naming.Context)
      + MinervaNoTransCMFactory (class: org.jboss.pool.connector.jboss.MinervaNoTransCMFactory)
      + INVMQueueConnectionFactory (class: org.jbossmq.SpyQueueConnectionFactory)
      + netlifePool (class: org.jboss.pool.jdbc.xa.XAPoolDataSource)

      Any ideas on how I can solve this problem?

      Thanks.





        • 1. Re: DatabaseServerLoginModule Can't Find DataSource
          Lachlan Macpherson Newbie

          Do you look up netlifePool or java:/netlifePool?

          • 2. Re: DatabaseServerLoginModule Can't Find DataSource
            Keith Teo Newbie

            Hi,

            I looked up java:/netlifePool

            Here is my auth.conf ( Client Side )

            other {
            // Put your login modules that work without jBoss here

            // jBoss LoginModule
            org.jboss.security.ClientLoginModule required debug=true;
            // Put your login modules that need jBoss here
            org.jboss.security.auth.spi.DatabaseServerLoginModule required
            dsJndiName="java:/netlifePool"
            principalsQuery="select Password from NLF_RealmUsers where UserName=?"
            rolesQuery="select GMGroup from NLF_RealmGroupMembers where GMMember=?"
            unauthenticatedIdentity=nobody
            ;
            };


            Here is my auth.conf, server side.

            // The default server login module
            other {
            // A simple server login module, which can be used when the number
            // of users is relatively small. It uses two properties files:
            // users.properties, which holds users (key) and their password (value).
            // roles.properties, which holds users (key) and a comma-separated list of their roles (value).
            // The unauthenticatedIdentity property defines the name of the principal
            // that will be used when a null username and password are presented as is
            // the case for an unuathenticated web client or MDB. If you don't want to
            // allow such users to be authenticated remove the property.
            org.jboss.security.auth.spi.UsersRolesLoginModule required
            unauthenticatedIdentity="nobody";
            org.jboss.security.ClientLoginModule required;

            org.jboss.security.auth.spi.DatabaseServerLoginModule required
            dsJndiName="java:/netlifePool"
            principalsQuery="select Password from NLF_RealmUsers where UserName=?"
            rolesQuery="select GMGroup from NLF_RealmGroupMembers where GMMember=?"
            unauthenticatedIdentity=nobody
            ;

            };


            And here is the extract from my jboss.jcml, which points to the MSSQL 7.0 database which I am trying to connect to. I am using ThinWeb's DB Driver for JDBC access.



            org.hsql.jdbcDriver,com.thinweb.tds.Driver,org.enhydra.instantdb.jdbc.idbDriver


            <!-- Free TWdts JDBC driver configuration for netlife pool obtained from www.thinweb.com-->

            org.jboss.pool.jdbc.xa.wrapper.XADataSourceImpl
            netlifePool
            3
            10
            jdbc:twtds:sqlserver://psdemo/millennia10;user=millennia10devdbusr;password=passw0rd


            Can anyone spot whether I am doing anything wrong here? I've been trying it for more then a day, and it still doesn't work. I am convinced I am missing something here, but I just can't spot what it is! Frustrating. :)



            • 3. Re: DatabaseServerLoginModule Can't Find DataSource
              Scott Stark Master

              The client side cannot access the java:/netlifePool as the java: context is only available inside of the server VM. You'll have to write your own client side login module that communicates with a server side component if you want to authenticate the client at login.

              • 4. Re: DatabaseServerLoginModule Can't Find DataSource
                Keith Teo Newbie

                Hi,

                But I am using the DatabaseServerLoginModule, and I think it is this module that is giving me the NameNotBound exception. On the client side, I am just calling a login method.

                Something like this..

                AppCallbackHandler handler = new AppCallbackHandler(name, password);
                LoginContext lc = new LoginContext("other", handler);
                System.out.println("Created LoginContext");
                lc.login();

                It is at lc.login(), that the exception is encountered. I don't understand what I am doing wrong. I thought the DatabaseServerLoginModule is a server side component, which executes within the app server VM? Or am I wrong to assume that?


                Thanks Stark.



                • 5. Re: DatabaseServerLoginModule Can't Find DataSource
                  Scott Stark Master

                  But you have the DatabaseServerLoginModule in your client side auth.conf file and this is gaurenteed not to work. The DatabaseServerLoginModule can only be used in the server auth.conf file.