当启动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. Maven报错解决:Element 'dependency' cannot have character [children], because the type's content type is

    在用maven的时候遇到报错: Element 'dependency' cannot have character [children], because the type's content ty ...

  2. Element 'dependency' cannot have character [children]

    问题:Element 'dependency' cannot have character [children], 原因:眼瞎 解决方法:看看你的特殊字符多写.少些.写错. 如下所示: <dep ...

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

    今天在写Springboot 项目的时候出现以下问题 这个是我在网站上复制的依赖,但是因为格式的错误就会报错,好像还发现不了,所以 我们只需要重新手打一遍就可以了

  4. Element ‘web-app’ cannot have character [children], because the type’s content type is element-onl

    将javaee改为j2ee. 如图

  5. Caused by: org.xml.sax.SAXParseException: cvc-elt.1: Cannot find the declaration of element 'beans'.

    信息: Initializing Spring root WebApplicationContext log4j:WARN No appenders could be found for logger ...

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

    [applicationContext.xml] is invalid; nested exception is org.xml.sax.SAXParseException: cvc-elt.1: C ...

  7. maven error: element dependency can not have character children

    就是Mavn pom.xml的解析错误,因为dependency这个标签中有不可见的垃圾字符,解决方法就是删掉重新打字进去就可以了. references: https://stackoverflow ...

  8. maven:ment 'dependency' cannot have character [children], because the type's content type is e

    应该是空白字符出现了问题,所以自己手打一遍就可以了,

  9. Spring常见问题

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

最新文章

  1. 面试题:mysql 数据类型
  2. Adobe Flash Builder 4.6 开发环境详解
  3. 纳尼?我的Gradle build编译只要1s
  4. Redis普通分布式锁
  5. ScaleAnimation缩放动画Demo
  6. 【论文】Realtime lane tracking of curved local road 检测和跟踪功能
  7. sh脚本异常:/bin/sh^M:bad interpreter: No such file ...
  8. IDC:2021年云上数据量超过传统数据中心,All in Cloud是趋势
  9. python 修改图片_Python实现批量修改图片格式和大小的方法【opencv库与PIL库】
  10. jenkins下载安装及环境搭建
  11. java实现冒泡排序
  12. java字符串第一个字母表达_取一个字符串的第一个字母
  13. Linux的远程管理协议是什么,2-Linux权限与远程管理
  14. CAS号:60535-02-6,二肽Met-Trp
  15. 2022 3.17网易互娱研发岗笔试题锯齿数独题解
  16. PHP微信公众号网页授权登录 扫码登录 获取用户基本信息
  17. unity基础(3)——从Unity Asset store获取资源
  18. CSP基础-CSP入门简介
  19. IRP_MJ_ACQUIRE_FOR_SECTION_SYNCHRONIZATION中的文件过滤
  20. 南大通用事务型数据库GBase 8s斩获2020年中国国际金融展“金鼎奖”

热门文章

  1. 炸了!我猜了7种颜色,就是没猜中苹果会出姨妈红!
  2. webpack基础教程:(二)
  3. 多线程junit单元测试
  4. C#反射Assembly 详细说明
  5. Linux系统-小倒腾之Linux DIY定制裁剪(New kernel+Busybox)o_o(二)
  6. Svchost进程应用技巧
  7. 《卷积神经网络》学习笔记
  8. 做数据分析时注意事项
  9. 大数据平台数据挖掘的作用是什么
  10. 布丰投针试验的仿真和误差估计