异常如下:
*******************************
org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 9 in XML document from class path resource [conf/applicationContext-security.xml] is invalid; nested exception is org.xml.sax.SAXParseException: cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'http'.
……
……
……
Caused by: org.xml.sax.SAXParseException: cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'http'.以下为springsecurity配置文件:applicationContext-security.xml
---------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns="http://www.springframework.org/schema/security"
  xmlns:beans="http://www.springframework.org/schema/beans"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://www.springframework.org/schema/beans
           http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
           http://www.springframework.org/schema/security
           http://www.springframework.org/schema/security/spring-security-3.1.xsd">
    <http auto-config='true'>
        <intercept-url pattern="/management/login*"  access="IS_AUTHENTICATED_ANONYMOUSLY" />
        <intercept-url pattern="/management/admin" access="ROLE_ADMIN"/>
        <intercept-url pattern="/management/**" access="ROLE_USER"/>
        <form-login login-page="/management/login" authentication-failure-url="/management/login?login_error=1"/> 
    </http>
    <authentication-manager>
        <authentication-provider>
            <user-service>
                <user name="admin" password="admin" authorities="ROLE_USER,ROLE_ADMIN"/>
                <user name="sharp" password="sharp" authorities="ROLE_USER"/>
            </user-service>
        </authentication-provider>
    </authentication-manager>
     <beans:bean id="messageSource"
        class="org.springframework.context.support.ReloadableResourceBundleMessageSource">
        <beans:property name="basename"  value="classpath:org/springframework/security/messages_zh_CN"/>  
     </beans:bean>
</beans:beans>
---------------------------------分割线------------------------------------------
web.xml文件:
*********************************************************
<?xml version="1.0" encoding="UTF-8"?>
<web-app 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">
<display-name>springmvc</display-name>
<description>this is a share project</description>
<!-- spring begin  -->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:conf/applicationContext-security.xml</param-value>
</context-param>

<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<!-- Spring end -->

<!-- springsecurity -->
<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>
<!-- springsecurity End -->

<!-- SpringMVC begin-->
<servlet>
<servlet-name>springmvc</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>springmvc</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
<!-- SpringMVC end -->
</web-app>
***************************************************springmvcweb.xmlspringspringsecurity<http>

解决方案 »

  1.   

    xsd无法解析http节点。改成 <s:http auto-config="true" use-expressions="true">
    试试?
      

  2.   

    都加前缀    <s:http auto-config='true'>
            <s:intercept-url pattern="/management/login*"  access="IS_AUTHENTICATED_ANONYMOUSLY" />
            <s:intercept-url pattern="/management/admin" access="ROLE_ADMIN"/>
            <s:intercept-url pattern="/management/**" access="ROLE_USER"/>
            <s:form-login login-page="/management/login" authentication-failure-url="/management/login?login_error=1"/> 
        </s:http>
      

  3.   

    org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 9 in XML document from class path resource [conf/applicationContext-security.xml] is invalid; nested exception is org.xml.sax.SAXParseException: The prefix "s" for element "s:http" is not bound.
    ……
    ……
    ……
    Caused by: org.xml.sax.SAXParseException: The prefix "s" for element "s:http" is not bound.