2 Replies Latest reply on Aug 13, 2004 3:04 AM by Olivier Olivier

    DatabaseServerLoginModule : datasource's name not bound

    Olivier Olivier Newbie

      Hi all,

      I'm configuring an application to use DatabaseServerLoginModule to authenticate users. According to my web application and the securioty tag of my web.xml I'm defining in my login-config.xml file a new application policy

      <application-policy name = "mood">
       <authentication>
       <login-module code="org.jboss.security.auth.spi.DatabaseServerLoginModule" flag="required" debug="true">
       <module-option name="dsJndiName">java:/MySqlDS</module-option>
       <module-option name="principalsQuery">select password from user where login=?</module-option>
       <module-option name="rolesQuery">select 'MoodUser', 'Roles' from user where login=?</module-option>
       </login-module>
       </authentication>
      </application-policy>
      


      In my deploy directory, I have an XML datasource defined as follows :

      <datasources>
       <local-tx-datasource>
       <jndi-name>MySqlDS</jndi-name>
       <connection-url>jdbc:mysql://127.0.0.1:3306/mood</connection-url>
       <driver-class>org.gjt.mm.mysql.Driver</driver-class>
       <user-name>root</user-name>
       <password></password>
       </local-tx-datasource>
      </datasources>
      


      I noticed I wasn't able to login and I turned on the trace. Here is the stack trace I get when debug is on:
      avax.security.auth.login.LoginException: org.jboss.util.NestedSQLException: Wrong credentials passed to getConnection!; - nested throwabl
      (org.jboss.resource.JBossResourceException: Wrong credentials passed to getConnection!)
       at org.jboss.security.auth.spi.DatabaseServerLoginModule.getUsersPassword(DatabaseServerLoginModule.java:115)
       at org.jboss.security.auth.spi.UsernamePasswordLoginModule.login(UsernamePasswordLoginModule.java:150)
       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:324)
       at javax.security.auth.login.LoginContext.invoke(LoginContext.java:675)
       at javax.security.auth.login.LoginContext.access$000(LoginContext.java:129)
       at javax.security.auth.login.LoginContext$4.run(LoginContext.java:610)
       at java.security.AccessController.doPrivileged(Native Method)
       at javax.security.auth.login.LoginContext.invokeModule(LoginContext.java:607)
       at javax.security.auth.login.LoginContext.login(LoginContext.java:534)
       at org.jboss.security.plugins.JaasSecurityManager.defaultLogin(JaasSecurityManager.java:487)
       at org.jboss.security.plugins.JaasSecurityManager.authenticate(JaasSecurityManager.java:442)
       at org.jboss.security.plugins.JaasSecurityManager.isValid(JaasSecurityManager.java:244)
       at org.jboss.security.plugins.JaasSecurityManager.isValid(JaasSecurityManager.java:219)
       at org.jboss.jetty.security.JBossUserRealm$JBossUserPrincipal.isAuthenticated(JBossUserRealm.java:91)
       at org.jboss.jetty.security.JBossUserRealm$JBossUserPrincipal.authenticate(JBossUserRealm.java:153)
       at org.jboss.jetty.security.JBossUserRealm.authenticate(JBossUserRealm.java:321)
       at org.mortbay.http.BasicAuthenticator.authenticated(BasicAuthenticator.java:50)
       at org.mortbay.http.SecurityConstraint.check(SecurityConstraint.java:415)
       at org.mortbay.http.HttpContext.checkSecurityConstraints(HttpContext.java:1518)
       at org.mortbay.jetty.servlet.ServletHttpContext.checkSecurityConstraints(ServletHttpContext.java:134)
       at org.mortbay.jetty.servlet.WebApplicationHandler.dispatch(WebApplicationHandler.java:235)
       at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:567)
       at org.mortbay.http.HttpContext.handle(HttpContext.java:1776)
       at org.mortbay.jetty.servlet.WebApplicationContext.handle(WebApplicationContext.java:514)
       at org.mortbay.http.HttpContext.handle(HttpContext.java:1726)
       at org.mortbay.http.HttpServer.service(HttpServer.java:879)
       at org.jboss.jetty.Jetty.service(Jetty.java:456)
       at org.mortbay.http.HttpConnection.service(HttpConnection.java:790)
       at org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:952)
       at org.mortbay.http.HttpConnection.handle(HttpConnection.java:807)
       at org.mortbay.http.SocketListener.handleConnection(SocketListener.java:196)
       at org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:289)
       at org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:487)


      Regards.

      Olivier.