@(编程)

现象描述

导入的一个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. R语言randomForest包实现随机森林——iris数据集和kyphosis数据集

    library(randomForest)model.forest<-randomForest(Species~.,data=iris)pre.forest<-predict(model. ...

  2. 相对定位、绝对定位在IE6的问题

    注意: 关于绝对定位,在IE6下定位元素的父级宽高都为奇数那么在IE6下定位元素的right,bottom都有一像素的偏差(left,top无偏差).因此应尽量使用偶数. 关于绝对定位,在IE6下父级 ...

  3. VC2005从开发MFC ActiveX ocx控件到发布到.net网站的全部过程

      开篇语:最近在弄ocx控件发布到asp.net网站上使用,就是用户在使用过程中,自动下载安装ocx控件.(此文章也是总结了网上好多人写的文章,我只是汇总一下,加上部分自己的东西,在这里感谢所有在网 ...

  4. Android Studio 学习 - 程序安装

    痛定思痛,从今天开始专心学习AndriodStudio.希望以此为契机,把Java学扎实.更希望自己能坚持下去,不要半途而废. 记录一些日常的工作以及碰到的问题,权当勉励自己.荀子曰:吾尝终日而思矣, ...

  5. 几款免费的不用数据库的php的cms

    免费不用数据库的php的cms 下面的几种内容采集系统都是英文版的,全部不需使用数据库,都是国外的免费并且开源CMS.对中文支持如何,你自己试试吧! 1.MuCMS一个小型,平台独立的内容管理系统适用 ...

  6. Android Window 9问9答

    1.简述一下window是什么?在android体系里 扮演什么角色? 答:window就是一个抽象类,他的实现类是phoneWindow.我们一般通过windowManager 来访问window. ...

  7. c# 修改appConfig文件节点

    配置文件对于程序的帮助是不可小视的,尤其是java工程师们,当然了,我这里说的是c#的配置文件.废话不多说了,直接上代码了,想必大家一看就会明白了 private string UpdateConfi ...

  8. 通过文件流stream下载文件

    public ActionResult ShowLocalizedXML(int id) { string orderName = ""; string xmlString = G ...

  9. C++调试 输出数组内容和数组名

    #include <cstdio> using namespace std; //函数定义 #define printArr(arr,n,format) \ printf("%s ...

  10. Http中Cookie与Set-Cookie头

    [原文:http://hi.baidu.com/qinglvzhuye/item/6664a807bb8be3dd73e676d6] android 获取 cookies 有很多办法,但是记住了. h ...