gpt4 book ai didi

java - 错误: cvc-elt. 1:找不到元素 'beans'的声明

转载 作者:行者123 更新时间:2023-11-30 05:59:36 57 4
gpt4 key购买 nike

我无法摆脱这个错误:

cvc-elt.1: Cannot find the declaration of element 'beans'.

我正在Tomcat 9上运行我的Web项目。我已经尝试了stackoverflow上提到的所有方法,仍然无法处理它。我猜这与 Spring 5 有关。

这是我的代码:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
">

<bean id="HandlerMapping" class="org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping"/>
<bean name="/welcome.html" class="com.gontuseries.hellocontroller.HelloController"/>
<bean id="ViewResolver"
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix">
<value>/WEB-INF/</value>
</property>
<property name="suffix">
<value>.jsp</value>
</property>
</bean>
</beans>

下面是我遇到的异常:

Sep 25, 2018 1:15:46 AM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Allocate exception for servlet [spring-dispatcher]
org.xml.sax.SAXParseException; lineNumber: 8; columnNumber: 6; cvc-elt.1: Cannot find the declaration of element 'beans'.
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown Source)

最佳答案

改变

    xmlns:schemaLocation="

    xsi:schemaLocation="

另请参阅xmlns, xmlns:xsi, xsi:schemaLocation, and targetNamespace?

关于java - 错误: cvc-elt. 1:找不到元素 'beans'的声明,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52486433/

57 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com