当启动spring的项目时,有时候会抛如下异常:

Line 33 in XML document from ServletContext resource [/WEB-INF/backend-servlet.xml] is invalid; nested exception is org.xml.sax.SAXParseException: cvc-complex-type.2.3: Element 'beans' cannot have character [children], because the type's content type is element-only.

异常提示是spring配置文件不能正确解析。

网上搜索了一下,发现都没有给出特别明确的答案

总结了一下,发现出现这种问题时很大一部分原因都是从别处(主要是网络)复制后粘贴到配置文件中的,所以应该和复制内容的编码有关系,或者和内容中有特殊的字符有关系,如果是手工敲入则不会有问题。

另外,如果只是将出问题的行内容清除,然后在问题行上手工输入,还是会有问题,应该是问题行的编码已经乱了,所以一定要删除问题行才行,否则还是会报错的。删除问题行后,在新的行上输入则不会有问题。

所以,如果要从网络复制,可以先复制到word中,word的好处就是可以看到那些网页上看不见的特殊字符,仔细看看有没有特殊字符,将其删除后在复制到配置文件中,这样就不会有问题了。

cvc-complex-type.2.3: Element 'beans' cannot have character [children]的更多相关文章

  1. Springs Element 'beans' cannot have character [children], because the type's content type is element-only

    Springs Element 'beans' cannot have character [children], because the type's content type is element ...

  2. 万能的ctrl+shift+F(Element 'beans' cannot have character [children], because the type's content type is element-only.错误)

    今天在spring-servlet.xml文件中出现了一个莫名其妙的错误:Element 'beans' cannot have character [children], because the t ...

  3. Element 'beans' cannot have character [children], because the type's content type is element-only

    这个小问题快搞死我了,找了大半个小时. Element 'beans' cannot have character [children], because the type's content typ ...

  4. xml文件报Element 'beans' cannot have character [children],because the type's content type is element

    写springMvc.xml文件时,偶然遇到 Element 'beans' cannot have character [children],because the type's content t ...

  5. Element 'beans' cannot have character [children]

    在编写spring的applicationContext.xml文件时,出现了: Element 'beans' cannot have character [children], because t ...

  6. Element 'dependencies' cannot have character[children],because the type's content type is elemen

    问题描述: Element 'xxxxxxx' cannot have character [children],because the type's content type is element- ...

  7. vc-complex-type.2.3: Element 'filter-mapping' cannot have character [children], because the type's content type is element-only.

    报这种错一般是因为导入的项目或者黏贴的代码中有中文空格或者中文编码,只需将报错代码重写一遍即可.

  8. Element 'plugin' cannot have character [children], because the type's content type is element-only

    原因是你复制的时候,带了一些特殊符号. 解决方案: 将那一串代码复制到notpad++ 或者文本上面,再复制到你的编译器里面,就可以解决问题了

  9. cvc-complex-type.2.3: Element 'dependency' cannot have character [children], because the type's cont

    直接复制网上的pom引入,报错 解决:自己手动输入一遍,不用直接复制,因为复制的时候,项目中编码跟网页上编码不一致,很容易导致出问题.

随机推荐

  1. Web自动化测试框架Watir(基于Ruby) - 第2章 使用Watir写自动化测试脚本

    一.先来看一个小DEMO 通过上一篇博文<Web自动化测试框架Watir(基于Ruby) - 第1章 Windows下安装与部署>的介绍,我们已经有了完整Watir运行环境,现在我们可以来 ...

  2. 异常: java.security.InvalidKeyException: Illegal key size

    今天在做接口测试的时候遇到个异常: java.security.InvalidKeyException: Illegal key size. SecretKeySpec secretKeySpec = ...

  3. 【appium】根据class_name定位元素

    目前没有尝试成功,等成功后补充 class_name=class可以通过UIAutomatorViewer获得.

  4. webpack创建library及从零开始发布一个npm包

    最近公司有个需求,我们部门开发一个平台项目之后,其他兄弟部门开发出的插件我们可以拿来直接用,并且不需要我们再进行打包,只是做静态的文件引入,研究一波后发现,webpack创建library可以实现. ...

  5. BASIC-19_蓝桥杯_完美的代价

    思路(贪心): 1.两边往中间逼近,步数少; 2.单个字符出现时只考虑移动到中间的步数,不做移动,因为这是最后进行,不影响结果; 示例代码: #include <stdio.h>#defi ...

  6. PHP PDO 预处理语句与存储过程

    很多更成熟的数据库都支持预处理语句的概念. 什么是预处理语句?可以把它看作是想要运行的 SQL 的一种编译过的模板,它可以使用变量参数进行定制.预处理语句可以带来两大好处: 查询仅需解析(或预处理)一 ...

  7. Ubuntu安装配置串口通讯工具minicom&&cutecom

    原帖地址:https://blog.csdn.net/gatieme/article/details/45310493 2017-04-07更新 发现新的工具gtkterm全名叫serial port ...

  8. Android RILD运行机制详解

    前言 在上一篇文章里(http://blog.csdn.net/jason_wzn/article/details/53232022),简要介绍了Android RIL的架构.这一篇文章,就来看一看R ...

  9. AWR实战分析之---- PX Deq Credit: send blkd (转载)

    该等待事件我在前面分析过,但是这次和上次产生的原因有些不一样,上次该等待事件的详细分析链接是:http://blog.sina.com.cn/s/blog_61cd89f60102eeen.html  ...

  10. ElasticSearch client API

    从运行结果看并没有打印节点信息出来 从结果看出来,集群节点信道打印出来了,不过这种方法有个问题,就是当我们连接的节点挂掉了,就没法连接整个集群了,这个时候我们就利用他的一个嗅探的功能. 从这里我们可以 ...