英文:
root-context.xml] is invalid; nested exception is org.xml.sax.SAXParseException; cvc-elt.1: Cannot find the declaration of element 'beans'
问题
我在多个问题中看到了相同的错误,并尝试了每个解决方案。似乎没有任何解决办法。我已经修剪了错误以便于更容易地粘贴,错误位于第7行的引号处。以下是我的 XML 代码。
TIA
编辑:我添加了调用 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:schemaLocation="
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>
英文:
I have seen this same error in multiple questions and tried each solution. Nothing seems to work. I trimmed the error for easier pasting the error is on line 7 at the quote. Here is my xml code.
TIA
EDIT I added the code that calls the 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>
答案1
得分: 1
将以下内容翻译为中文:
将
xsi:schemLocation="
替换为
xsi:schemaLocation="
^
英文:
Change
xsi:schemLocation="
to
xsi:schemaLocation="
^
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论