解决eclipse spring-MVC配置报错:cvc-elt.1: Cannot find the declaration of element 'beans'.

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

spring-MVC配置一直报错:cvc-elt.1: Cannot find the declaration of element 'beans'.

联网正常,  http://www.springframework.org/schema/beans/spring-beans.xsd,浏览器可正常打开。

原因是无法从网络上读取到相应的schema文件,但实际上在浏览器中是可以访问的。

可以改成    xsi:schemaLocation="
                          http://www.springframework.org/schema/beans
                         classpath:/org/springframework/beans/factory/xml/spring-beans-2.5.xsd
                         http://www.springframework.org/schema/context
                        http://www.springframework.org/schema/context/spring-context.xsd">

从本地JAR包获取即可,无需从网上读取

猜你喜欢

转载自blog.csdn.net/libaowen609/article/details/81381623