当启动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. os层删除与数据库层drop的区别于对策。

    os rm删除的,可以通过os层面恢复(句柄.inode.如果inode没有了可以根据block去重组出来数据文件),也可以通过rman备份还原方式恢复.  db 层面drop删除的 只能不完全恢复( ...

  2. Maven的dependency scope属性

    官方地址:https://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#Dependen ...

  3. c#中如何保存焦点控件?

    对所有文本框添加焦点获得事件,头部再定义一个全局的object或者control的类型对象,在焦点获得事件中把当前控件对象赋值给之前定义的object或者control对象,操作的话就对这个全局量操作 ...

  4. 洛谷4030(Codeplus11月月赛)可做题1

    题目:https://www.luogu.org/problemnew/show/P4030 原来一个方阵巧妙的充要条件是该方阵的每个2*2子方阵都是巧妙的!!! 可以把每一行选的列视为一个排列,需要 ...

  5. RequiresAuthentication

    @RequiresAuthentication 验证用户是否登录,等同于方法subject.isAuthenticated() 结果为true时. @RequiresUser 验证用户是否被记忆,us ...

  6. c#中如何获取本机MAC地址、IP地址、硬盘ID、CPU序列号等系统信息

    我们在利用C#开发桌面程序(Winform)程序的时候,经常需要获取一些跟系统相关的信息,例如用户名.MAC地址.IP地址.硬盘ID.CPU序列号.系统名称.物理内存等. 首先需要引入命名空间: us ...

  7. jquery dataTable的学习

    http://www.cnblogs.com/nier/archive/2012/03/19/2406450.html 分页 bPaginite:true;是否启用分页功能 sPaginationTy ...

  8. js阻止默认事件、拖拽等等

    1.自定义右键菜单: <!DOCTYPE HTML> <html> <head> <meta charset="utf-8"> &l ...

  9. Linux 期中架构 SSH

    为其他网络服务提供安全协议.替代Telnet SSH:   实现数据加密传输 22  默认支持root用户远程连接 类似sftp-server服务 nmap -p 22 10.0.0.41 nc 10 ...

  10. 初次从eclipse转到intellij idea上的一些经验

    如果出现:mvn 请使用 -source 7 或更高版本以启用 diamond 运算符 这种问题 pom.xml里 <build>标签里面 需要加入这么一段 <plugins> ...