jkong18 2012-07-31 13:22
浏览 698
已采纳

Spring Security /j_spring_security_check 无法找到404错误

Spring Security /j_spring_security_check 无法找到404错误。在WAS7和JBoss上都试过了,一样的错误。在WAS上也试过加入com.ibm.ws.webcontainer.invokeFiltersCompatibility=true,都不成功。

//-- web.xml --//

<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" version="2.5"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
&lt;!-- load Spring configurations --&gt;
&lt;context-param&gt;
    &lt;param-name&gt;contextConfigLocation&lt;/param-name&gt;
    &lt;param-value&gt;/WEB-INF/myApplicationContext.xml&lt;/param-value&gt;
&lt;/context-param&gt;

&lt;filter&gt;
    &lt;filter-name&gt;springSecurityFilterChain&lt;/filter-name&gt;
    &lt;filter-class&gt;org.springframework.web.filter.DelegatingFilterProxy&lt;/filter-class&gt;
&lt;/filter&gt;

&lt;filter-mapping&gt;
    &lt;filter-name&gt;springSecurityFilterChain&lt;/filter-name&gt;
    &lt;url-pattern&gt;/*&lt;/url-pattern&gt;
&lt;/filter-mapping&gt;

&lt;listener&gt;
    &lt;listener-class&gt;org.springframework.web.context.ContextLoaderListener&lt;/listener-class&gt;
&lt;/listener&gt;

&lt;welcome-file-list&gt;
    &lt;welcome-file&gt;index.html&lt;/welcome-file&gt;
    &lt;welcome-file&gt;index.htm&lt;/welcome-file&gt;
    &lt;welcome-file&gt;index.jsp&lt;/welcome-file&gt;
    &lt;welcome-file&gt;default.html&lt;/welcome-file&gt;
    &lt;welcome-file&gt;default.htm&lt;/welcome-file&gt;
    &lt;welcome-file&gt;default.jsp&lt;/welcome-file&gt;
&lt;/welcome-file-list&gt;

</web-app>



//-- myApplicationContext.xml --//
<?xml version="1.0" encoding="UTF-8" ?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:security="http://www.springframework.org/schema/security"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
http://www.springframework.org/schema/security
http://www.springframework.org/schema/security/spring-security-3.1.xsd">
&lt;security:http auto-config="true"&gt;
    &lt;security:form-login login-processing-url="/j_spring_security_check"
                         login-page="/login.jsp"
                         authentication-failure-url="/login.jsp" /&gt;
    &lt;security:intercept-url pattern="/secured/**" access="ROLE_ADMIN" /&gt;
    &lt;security:logout /&gt;
&lt;/security:http&gt; 

&lt;security:user-service id="dummyUserRegistry"&gt;
    &lt;security:user name="jack" password="12345678" authorities="ROLE_ADMIN" /&gt;
&lt;/security:user-service&gt;

&lt;security:authentication-manager&gt;
    &lt;security:authentication-provider user-service-ref="dummyUserRegistry" /&gt;
&lt;/security:authentication-manager&gt;

</beans>



//-- JSP --//
 <form method="POST" action="/j_spring_security_check">
<label for="j_username">Username:&nbsp;&nbsp;</label>
<input type="text" name="j_username" /><br/>
<label for="j_password">Password:&nbsp;&nbsp;</label>
<input type="password" name="j_password" /><br/>
<input type="submit" value="Login" />
</form>


问题补充
这个貌似是老生常谈的问题,但是我试了很多的方法,依然不行。

在WAS7上加了invokeFiltersCompatibility=true,还是不行。换了JBoss 7.1,同样错误,应该和平台无关了,应该是我的配置出问题了。

求指正
  • 写回答

1条回答 默认 最新

  • Dead_Knight 2012-07-31 15:11
    关注


    修改为:

    或者
    action="/j_spring_security_check">
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥30 python代码,帮调试
  • ¥15 #MATLAB仿真#车辆换道路径规划
  • ¥15 java 操作 elasticsearch 8.1 实现 索引的重建
  • ¥15 数据可视化Python
  • ¥15 要给毕业设计添加扫码登录的功能!!有偿
  • ¥15 kafka 分区副本增加会导致消息丢失或者不可用吗?
  • ¥15 微信公众号自制会员卡没有收款渠道啊
  • ¥100 Jenkins自动化部署—悬赏100元
  • ¥15 关于#python#的问题:求帮写python代码
  • ¥20 MATLAB画图图形出现上下震荡的线条