spring gwt无法找到元素'beans'的声明

时间:2015-11-06 16:10:43

标签: java xml spring gwt

当我尝试开始时,我得到了例外         

<beans:beans xmlns="http://www.springframework.org/schema/security"
             xmlns:context="http://www.springframework.org/schema/context"
             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-4.2.1.xsd
                        http://www.springframework.org/schema/security
                        http://www.springframework.org/schema/security/spring-security-3.2.4.xsd
                        http://www.springframework.org/schema/context
                        http://www.springframework.org/schema/context/spring-context-4.2.1.xsd"
        >


    <http auto-config="true">
        <intercept-url pattern="/securegwt/**" access="ROLE_USER" />
        <intercept-url pattern="/gwt/**" access="ROLE_USER" />
        <intercept-url pattern="/**/*.html" access="ROLE_USER" />
        <intercept-url pattern="/BuyerSide.html" access="IS_AUTHENTICATED_ANONYMOUSLY" />
    </http>

    <beans:bean id="customAuthenticationProvider"
                class="project.server.security.CustomAuthenticationProvider" />

    <authentication-manager alias="authenticationManager">
        <authentication-provider ref="customAuthenticationProvider" />
    </authentication-manager>

    <context:component-scan base-package="project"/>

</beans:beans>
  

Failed startup of context
> c.g.g.d.s.j.WebAppContextWithReload{/,file:/C:/Users/Denis/.IntelliJIdea14/system/gwt/NProject.b3f6e62/NProject.479fd482/run/www/},C:\Users\Denis\.IntelliJIdea14\system\gwt\NProject.b3f6e62\NProject.479fd482\run\www
> org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException:
> Line 9 in XML document from ServletContext resource
> [/WEB-INF/applicationContext.xml] is invalid; nested exception is
> org.xml.sax.SAXParseException; lineNumber: 9; columnNumber: 76;
> cvc-elt.1: Cannot find the declaration of element 'beans'.

1 个答案:

答案 0 :(得分:0)

您的XML标头引用了一些无效的XSD。改变这个:

xsi:schemaLocation="
                    http://www.springframework.org/schema/beans
                    http://www.springframework.org/schema/beans/spring-beans-4.2.1.xsd
                    http://www.springframework.org/schema/security
                    http://www.springframework.org/schema/security/spring-security-3.2.4.xsd
                    http://www.springframework.org/schema/context
                    http://www.springframework.org/schema/context/spring-context-4.2.1.xsd"

到此:

xsi:schemaLocation="
                    http://www.springframework.org/schema/beans
                    http://www.springframework.org/schema/beans/spring-beans-4.2.xsd
                    http://www.springframework.org/schema/security
                    http://www.springframework.org/schema/security/spring-security-3.2.xsd
                    http://www.springframework.org/schema/context
                    http://www.springframework.org/schema/context/spring-context-4.2.xsd"