@(编程)

现象描述

导入的一个eclipse项目报错,各种方法都无法解决,报错信息如下:

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

报错文件是applicationContext-ehcache.xml

原因分析

是因为引用的spring包与声明的头文件版本号不一致,改成一致就好了。

解决方法

原来的头文件声明是:

<beans
xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:cache="http://www.springframework.org/schema/cache"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd
http://www.springframework.org/schema/cache http://www.springframework.org/schema/cache/spring-cache.xsd"
default-autowire="byName" default-lazy-init="false">

查看引用jar文件,spring-core是3.2.9的版本,因此修改如下:

<beans
xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:cache="http://www.springframework.org/schema/cache"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd
http://www.springframework.org/schema/cache http://www.springframework.org/schema/cache/spring-cache-3.2.xsd"
default-autowire="byName" default-lazy-init="false">

去以下三个地址查了一下:

http://www.springframework.org/schema/beans/
http://www.springframework.org/schema/context/
http://www.springframework.org/schema/cache/

仍然不行

按照以上步骤修改之后,仍然报错,即使clean在compile也出错。

修改以上内容变成最简单,eclipse不再报错,然后再改回来。最简单的版本如下:

<beans
xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:cache="http://www.springframework.org/schema/cache"
>

cvc-elt.1: Cannot find the declaration of element 'beans'的更多相关文章

  1. spring cvc-elt.1: Cannot find the declaration of element 'beans'解决办法

    转载自http://blog.csdn.net/legendj/article/details/9950963 今天在写spring aop示例的时候,在spring.xml文件中添加spring a ...

  2. Spring 异常 —— cvc-elt.1: Cannot find the declaration of element 'beans'

    有个使用 Spring 的项目,运行时报错: org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 5 ...

  3. cvc-elt.1: Cannot find the declaration of element 'beans'Failed to read schema document 'http://www.springframework.org/schema/beans/spring- beans-3.0.xsd'

    Multiple annotations found at this line: - cvc-elt.1: Cannot find the declaration of element 'beans' ...

  4. Spring启动异常: cvc-elt.1: Cannot find the declaration of element 'beans'(转)

    Spring启动异常: cvc-elt.1: Cannot find the declaration of element 'beans' 2008-09-07 22:41 今天把在线聊天室代码改了下 ...

  5. nested exception is org.xml.sax.SAXParseException: cvc-elt.1: Cannot find the declaration of element 'beans'.

    1缺少jar包 2spring配置文件里http://www.springframework.org/schema/beans/spring-beans-3.2.xsd的版本与实际jar包不一致

  6. (Spring加载xml时)org.xml.sax.SAXParseException: cvc-elt.1: Cannot find the declaration of element 'beans'.

    ApplicationContext ctx = new ClassPathXmlApplicationContext("test.xml");报错 在启动Spring时,报以下错 ...

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

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

  8. Cannot find the declaration of element 'ehcache'.

    ehchahe.xml中报错: Cannot find the declaration of element 'ehcache'. 由于 <?xml version="1.0" ...

  9. idea中ehcahe配置中 Cannot find the declaration of element 'ehcache'.

    ehcahe.xml 中报错: Cannot find the declaration of element 'ehcache'. 打开settings->languages&frame ...

随机推荐

  1. splay入门

    在比较了网上的几份模板的速度之后,发现指针版明显快了很多,但是一敲起来....各种不习惯...所以还是学的hzwer 的数组版... bzoj3223:维护reverse操作就可以了 #include ...

  2. win7x64安装wince6

    Windows Embedded CE 安装方法 Wince的安装相对比较复杂,即使是一个Wince的老手,也可能遇到这样那样的问题.想来真是悲摧,Windows XP, Windows 7,64位, ...

  3. hibernate封装查询,筛选条件然后查询

    // 封装查询条件 @Test public void transmitParameter() { Map map = new HashMap<String, String>(); // ...

  4. shell 括号学习

    http://blog.csdn.net/tttyd/article/details/11742241 http://tldp.org/LDP/abs/html/loops1.html

  5. 【Python】Python重新学习

    <python基础教程(第二版)> http://www.cnblogs.com/fnng/category/454439.html 分片(后面取的是前一位) eg: >>&g ...

  6. 在centOS中加入本地ISO yum源

    注:本文转载自<liujun_live的博客>,感谢原博主的辛勤写作:原文地址:http://blog.sina.com.cn/s/blog_8ea8e9d50101em6f.html 在 ...

  7. Hadoop1.1.2伪分布式安装笔记

    一.设置Linux的静态IP 修改桌面图标修改,或者修改配置文件修改 1.先执行ifconfig,得到网络设备的名称eth0 2.编辑/etc/sysconfig/network-scripts/if ...

  8. 在python中如何设置当前工作目录

    import osos.chdir('要设置的当前目录') >>> import os >>> os.getcwd() 'D:\\Python27' >> ...

  9. arcgis for android 无法加载本地jpg影像解决办法

    因为jpg影像没有生成金子塔文件*.rrd 一个完整的JPG影像必须包括如下文件: K-50-96-(16).aux  辅助文件K-50-96-(16).jgw  坐标信息K-50-96-(16).j ...

  10. Eclipse中安装可以新建html文件的插件(Eclipse HTML Editor)

    最近在eclipse中开发android项目,用到了jquery mobile框架,则会涉及到新建html文件,发现eclipse不自带新建html文件的插件,必须得新建一个其他形式的文件,譬如xml ...