简体   繁体   English

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

[英]Error: cvc-elt.1: Cannot find the declaration of element 'beans'

I cannot get rid of this error:我无法摆脱这个错误:

cvc-elt.1: Cannot find the declaration of element 'beans'. cvc-elt.1:找不到元素“beans”的声明。

I am running my web project on Tomcat 9. I have tried all the ways mentioned on stackoverflow, still unable to deal with it.我在Tomcat 9 上运行我的web 项目。我已经尝试了stackoverflow 上提到的所有方法,仍然无法处理它。 I guess it has something to do with the Spring 5.我想这与Spring 5有关。

Here is my code:这是我的代码:

<?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>

and below is the exception I am getting:以下是我得到的例外:

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)

Change改变

    xmlns:schemaLocation="

to

    xsi:schemaLocation="

See also xmlns, xmlns:xsi, xsi:schemaLocation, and targetNamespace?另请参见xmlns、xmlns:xsi、xsi:schemaLocation 和 targetNamespace?

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Spring:-cvc-elt.1:找不到元素“ beans”的声明 - Spring :- cvc-elt.1: Cannot find the declaration of element 'beans' cvc-elt.1:找不到元素“beans”的声明 - cvc-elt.1: Cannot find the declaration of element 'beans' 在Spring应用程序中遇到错误:cvc-elt.1:找不到元素&#39;beans&#39;的声明 - Getting an error in spring application: cvc-elt.1: Cannot find the declaration of element 'beans' 使用spring获取错误消息“cvc-elt.1:找不到元素'beans'的声明。” - Getting error message with spring “cvc-elt.1: Cannot find the declaration of element 'beans'.” org.xml.sax.SAXParseException; lineNumber:6; columnNumber:122; cvc-elt.1:找不到元素&#39;beans&#39;的声明 - org.xml.sax.SAXParseException; lineNumber: 6; columnNumber: 122; cvc-elt.1: Cannot find the declaration of element 'beans' Spring cvc-elt.1:找不到元素&#39;beans&#39;的声明和类似的问题 - Spring cvc-elt.1: Cannot find the declaration of element 'beans' and similar problems cvc-elt.1:找不到RootElement的元素声明 - cvc-elt.1: Cannot find the declaration of element for RootElement cvc-elt.1:找不到元素&#39;NewIssue&#39;的声明 - cvc-elt.1: Cannot find the declaration of element 'NewIssue' 使用cvc-elt.1进行xsd验证失败:无法找到元素的声明 - xsd validation fails with cvc-elt.1: Cannot find the declaration of element XML,XSD,cvc-elt.1:找不到元素的声明 - XML, XSD, cvc-elt.1: Cannot find the declaration of element
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM