当启动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. 解决首次访问jenkins,输入初始化默认密码之后,一直卡住问题,无法进行jenkins工具安装

    参考网址:http://www.cnblogs.com/520playboy/p/6244257.html 简介   安装系统:centos6.5 安装方式:在官网中下载jenkins.war,放到t ...

  2. bzoj1042硬币购物

    题目:http://www.lydsy.com/JudgeOnline/problem.php?id=1042 dp预处理+容斥原理. 先预处理求出无限制的各面值的组成方案数 f (完全背包). 求s ...

  3. jmeter --上传文件

    jmeter-场景-上传文件-send-a-file 简要说就3点: POST请求 Request的参数都写在路径内,不写在表单里 上传的文件写在表单里 只要记住以上3点,也就避免了在设计脚本的时候走 ...

  4. vuex基本熟悉与使用

    vuex的入门与使用讲解 官网:https://vuex.vuejs.org/zh/guide/state.html 定义:Vuex 是一个专为 Vue.js 应用程序开发的状态管理模式.它采用集中式 ...

  5. Go 的类型断言type assertion

    Go语言中的类型断言,语法上是这样的: x.(T) 其中,x是interface接口的表达式,T是类型,称为被断言类型. 补充一下,接口有接口值的概念,其包括动态类型和动态值两部分. 类型断言根据T的 ...

  6. [转]csharp:Microsoft.Ink 手写识别(HandWriting Recognition)

    原贴:http://www.cnblogs.com/geovindu/p/3702427.html 下載: //Microsoft Windows XP Tablet PC Edition 2005 ...

  7. Mybatis常见面试题 三

    1.什么是mybatis? (1)mybatis是一个优秀的基于java的持久层框架,它内部封装了jdbc,使开发者只需要关注sql语句本身,而不需要花费精力去处理加载驱动.创建连接.创建statem ...

  8. java 中getDeclaredFields() 与getFields() 的区别

    java 中getDeclaredFields() 与getFields() 的区别 getDeclaredFields()返回Class中所有的字段,包括私有字段.例证: package com.t ...

  9. 招募贴:Hadoop专业解决方案招募义务翻译人员

    一.招募启事 招募贴:Hadoop专业解决方案招募义务翻译人员,英文原著名称:<Wrox.Professional.Hadoop.Solutions>.愿意参与到此项工作中来的请加群:31 ...

  10. pandas的map函数与apply函数的区别

    import pandas as pd import numpy as np df = pd.DataFrame(np.random.randn(4,3),columns=list("ABC ...