首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > Java Exception >

acegi权限验证,org.acegisecurity.AuthenticationServiceException: PreparedStatementCal

2014-01-26 
acegi的配置(省略前面的,只把sql写出来了): bean id userDetailsService class org.acegisecurity.u

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\springtest\commons\404.jsp>
2007-04-09 09:57:49,000 DEBUG [org.apache.jasper.servlet.JspServlet] - < RequestURI: /springtest/commons/404.jsp>
2007-04-09 09:57:49,000 DEBUG [org.apache.jasper.servlet.JspServlet] - < QueryString: null>
2007-04-09 09:57:49,000 DEBUG [org.apache.jasper.servlet.JspServlet] - < Request Params: >

问题:
1。这个越界怎么解释呢?
2。就算失败,怎么转到404。jsp呢,我在authenticationProcessingFilter里面定义了authenticationFailureUrl的啊?

------解决方法--------------------------------------------------------
1.是因为你项目中使用的数据库登录用户没有操作users这个表的权限。
2.不知道authenticationProcessingFilter这个里面你是怎么处理的,但是你要控制错误页面的话,可以在web.xml设置error-page:
<error-page>
<error-code> 404 </error-code>
<location> /*.jsp </location>
</error-page>

        

热点排行