1 Reply Latest reply on Nov 11, 2002 2:15 PM by Rob Stokes

    ERROR DatabaseServerLoginModule SQL failure

    tfw Newbie

      Hello,

      I keep getting this error every time I try to authenticate. It only returns the error if it's a valid username and password otherwise it returns correctly authentication failure.

      16:37:29,801 ERROR [DatabaseServerLoginModule] SQL failure
      The column index is out of range.
      at org.postgresql.jdbc2.ResultSet.getString(ResultSet.java:166)
      at org.jboss.security.auth.spi.DatabaseServerLoginModule.getRoleSets(DatabaseServerLoginModule.java:178)
      at org.jboss.security.auth.spi.AbstractServerLoginModule.commit(AbstractServerLoginModule.java:146)
      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:535)
      at org.jboss.security.plugins.JaasSecurityManager.defaultLogin(JaasSecurityManager.java:381)
      at org.jboss.security.plugins.JaasSecurityManager.authenticate(JaasSecurityManager.java:347)
      at org.jboss.security.plugins.JaasSecurityManager.isValid(JaasSecurityManager.java:215)
      at org.jboss.jetty.security.JBossUserRealm$JBossUserPrincipal.isAuthenticated(JBossUserRealm.java:72)
      at org.jboss.jetty.security.JBossUserRealm$JBossUserPrincipal.authenticate(JBossUserRealm.java:133)
      at org.jboss.jetty.security.JBossUserRealm.authenticate(JBossUserRealm.java:248)
      at org.mortbay.jetty.servlet.FormAuthenticator.authenticated(FormAuthenticator.java:96)
      at org.mortbay.jetty.servlet.WebApplicationContext.checkSecurityContstraints(WebApplicationContext.java:1116)
      at org.mortbay.jetty.servlet.WebApplicationHandler.dispatch(WebApplicationHandler.java:253)
      at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:554)
      at org.mortbay.jetty.servlet.WebApplicationHandler.handle(WebApplicationHandler.java:199)
      at org.mortbay.http.HttpContext.handle(HttpContext.java:1572)
      at org.mortbay.http.HttpContext.handle(HttpContext.java:1522)
      at org.mortbay.http.HttpServer.service(HttpServer.java:795)
      at org.jboss.jetty.Jetty.service(Jetty.java:531)
      at org.mortbay.http.HttpConnection.service(HttpConnection.java:784)
      at org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:941)
      at org.mortbay.http.HttpConnection.handle(HttpConnection.java:799)
      at org.mortbay.http.SocketListener.handleConnection(SocketListener.java:186)
      at org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:322)
      at org.mortbay.util.ThreadPool$JobRunner.run(ThreadPool.java:716)
      at java.lang.Thread.run(Thread.java:536)

      Here's the login-config.xml

      application-policy name = "WebPortalRealm">

      <login-module code = "org.jboss.security.auth.spi.DatabaseServerLoginModule" flag = "required">
      <module-option name = "dsJndiName">java:/PostgresDS</module-option>
      <module-option name = "principalsQuery">select password from userejb where id=?</module-option>
      <module-option name = "rolesQuery"> select roles from rolesejb where id=?</module-option>
      </login-module>

      </application-policy>

      The userejb and rolesejb tables appear like so:

      Table "userejb"
      Column | Type | Modifiers
      ----------+--------+-----------
      id | text |
      unixid | bigint |
      userid | bigint |
      password | text |
      email | text |
      phone | text |
      fullname | text |

      Table "rolesejb"
      Column | Type | Modifiers
      --------+--------+-----------
      roles | text |
      id | text |
      userid | bigint |

      any help would be appreciated.

      Thanks