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"><!-- load Spring configurations --> <context-param> <param-name>contextConfigLocation</param-name> <param-value>/WEB-INF/myApplicationContext.xml</param-value> </context-param> <filter> <filter-name>springSecurityFilterChain</filter-name> <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class> </filter> <filter-mapping> <filter-name>springSecurityFilterChain</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> <listener> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> </listener> <welcome-file-list> <welcome-file>index.html</welcome-file> <welcome-file>index.htm</welcome-file> <welcome-file>index.jsp</welcome-file> <welcome-file>default.html</welcome-file> <welcome-file>default.htm</welcome-file> <welcome-file>default.jsp</welcome-file> </welcome-file-list>
</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"><security:http auto-config="true"> <security:form-login login-processing-url="/j_spring_security_check" login-page="/login.jsp" authentication-failure-url="/login.jsp" /> <security:intercept-url pattern="/secured/**" access="ROLE_ADMIN" /> <security:logout /> </security:http> <security:user-service id="dummyUserRegistry"> <security:user name="jack" password="12345678" authorities="ROLE_ADMIN" /> </security:user-service> <security:authentication-manager> <security:authentication-provider user-service-ref="dummyUserRegistry" /> </security:authentication-manager>
</beans>
//-- JSP --//
<form method="POST" action="/j_spring_security_check">
<label for="j_username">Username: </label>
<input type="text" name="j_username" /><br/>
<label for="j_password">Password: </label>
<input type="password" name="j_password" /><br/>
<input type="submit" value="Login" />
</form>
问题补充
这个貌似是老生常谈的问题,但是我试了很多的方法,依然不行。
在WAS7上加了invokeFiltersCompatibility=true,还是不行。换了JBoss 7.1,同样错误,应该和平台无关了,应该是我的配置出问题了。
求指正