日期:2014-05-18  浏览次数:20885 次

使用acegi进行权限验证,提示sql异常,思不得解,故抛出来大家帮忙看看(100分)
acegi的配置(省略前面的,只把sql写出来了):
<bean   id= "userDetailsService "
class= "org.acegisecurity.userdetails.jdbc.JdbcDaoImpl ">
<property   name= "dataSource "> <ref   bean= "dataSource "/> </property>

<property   name= "usersByUsernameQuery ">
<value>
select   name,passwd   from   users   where   name   =   ?
</value>
</property>
</bean>


异常:
2007-04-09   09:57:49,000   DEBUG   [org.acegisecurity.ui.webapp.AuthenticationProcessingFilter]   -   <Authentication   request   failed:   org.acegisecurity.AuthenticationServiceException:   PreparedStatementCallback;   uncategorized   SQLException   for   SQL   [
select   name,passwd   from   users   where   name   =   ?
];   SQL   state   [S1009];   error   code   [0];   Column   Index   out   of   range,   3   >   2.   ;   nested   exception   is   java.sql.SQLException:   Column   Index   out   of   range,   3   >   2.   ;   nested   exception   is   org.springframework.jdbc.UncategorizedSQLException:   PreparedStatementCallback;   uncategorized   SQLException   for   SQL   [
select   name,passwd   from   users   where   name   =   ?
];   SQL   state   [S1009];   error   code   [0];   Column   Index   out   of   range,   3   >   2.   ;   nested   exception   is   java.sql.SQLException:   Column   Index   out   of   range,   3   >   2.   >
2007-04-09   09:57:49,000   DEBUG   [org.acegisecurity.context.HttpSessionContextIntegrationFilter]   -   <SecurityContextHolder   set   to   new   context,   as   request   processing   completed>
2007-04-09   09:57:49,000   DEBUG   [org.apache.catalina.core.ApplicationDispatcher]   -   <servletPath=/commons/404.jsp,   pathInfo=null,   queryString=null,   name=null>
2007-04-09   09:57:49,000   DEBUG   [org.apache.catalina.core.ApplicationDispatcher]   -   <   Path   Based   Forward>
2007-04-09   09:57:49,000   DEBUG   [org.apache.jasper.servlet.JspServlet]   -   <JspEngine   -->   /commons/404.jsp>
2007-04-09   09:57:49,000   DEBUG   [org.apache.jasper.servlet.JspServlet]   -   <           ServletPath:   /commons/404.jsp>
2007-04-09   09:57:49,000   DEBUG   [org.apache.jasper.servlet.JspServlet]   -   <                 PathInfo:   null>
2007-04-09   09:57:49,000   DEBUG   [org.apache.jasper.servlet.JspServlet]   -   <                 RealPath:   D:\Apache   Software   Foundation\Tomcat   5.5\webapps\