root context.xml]无效;嵌套异常为org.xml.sax.saxparseexception;cvc elt.1:找不到元素“beans”的声明

yr9zkbsy  于 2021-07-12  发布在  Java
关注(0)|答案(1)|浏览(459)

我在多个问题中看到了同样的错误,并尝试了每个解决方案。似乎什么都没用。我修剪了错误,以便更容易粘贴错误是在第7行的报价。这是我的xml代码。我添加了调用root-context.xml的代码

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xmlns="http://java.sun.com/xml/ns/javaee" 
xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" 
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee web-app_2_5.xsd" 
version="2.5">
<display-name>Subject</display-name>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/spring/root-context.xml</param-value>
</context-param>
</web-app>

<?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:util="http://www.springframework.org/schema/util" 
    xmlns:beans="http://www.springframework.org/schema/beans" 
    xsi:schemLocation="
    http://www.springframework.org/schema/util 
    http://www.springframework.org/schema/util/spring-util-3.1.xsd
    http://www.springframework.org/schema/beans 
    http://www.springframework.org/schema/beans/spring-beans-3.1.xsd">  

<beans:import resource="security-context.xml" /> 
<beans:bean id="subjectProps" 
    class="org.springframework.beans.factory.config.PropertiesFactoryBean"> 
    <beans:property name="locations">
        <beans:list> 
            <beans:value>WEB-INF/spring/subject.properties</beans:value> 
            <beans:value>WEB-INF/spring/subject_sql.properties</beans:value> 
        </beans:list> 
    </beans:property> 
</beans:bean>

<beans:bean id="subjectUtilProperites" 
 class="main.java.mil.serena.subject.common.SubjectProperties"> 
    <beans:property name="properties" ref="subjectProps"/> 
</beans:bean> 
<beans:bean id="publicationUtilProperties" 
  class="main.java.mil.serena.web.common.properties.SubPubProperties"> 
    <beans:property name="properties" ref="subjectProps"/> 
</beans:bean>
</beans>
oewdyzsn

oewdyzsn1#

改变

xsi:schemLocation="

xsi:schemaLocation="
             ^

相关问题