当启动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.4.d: Invalid content was found 具体参考http://henatne.iteye.com/blog/837186
主要给大家介绍了关于spring配置文件解析失败报”cvc-elt.1: 找不到元素 'beans' 的声明”异常的解决方法,需要的朋友可以参考下
- cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'dubbo:application'. - schema_reference.4: Failed to read schema document '...
BPMN2新规范 业界牛逼,流程建模设计,自动化,的工作流引擎
关于javascript经典例子 是一些基础功能
cvc-complex-type.2.4.a: Invalid content was found starting with element 'page-encoding'. One of '{"http:// java.sun.com/xml/ns/javaee":include-prelude, ...
- cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'dubbo:application'. - schema_reference.4: Failed to read schema document '...
- cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'dubbo:application'. - schema_reference.4: Failed to read schema document '...
CVC-C07-01:2017A3 强制性产品认证实施细则-家用和类似用途设备.pdf
- cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'dubbo:application'. - schema_reference.4: Failed to read schema document '...
- cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'dubbo:application'. - schema_reference.4: Failed to read schema document 'http:// code....
cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'mvc:resources' 报错
- cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'dubbo:application'. - schema_reference.4: Failed to read schema document '...
CVC-T 数据集是一个更广泛的数据集的测试集,称为 Endoscene。CVC-T 由从 36 名患者获得的 44 个视频序列中获得的 60 张图像组成。 一度找不到这个单独的数据集,但其实是包含在一整个医学分割网络的训练策略里的,...
dubbo.xsd文件,主要解决xml报错cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaratio
2018中国CVC行业发展报告-清华五道口-2019.1-88页
在写xml的时候又一次总是报cvc-complex-type.2.4.a: Invalid content was found starting with element 错误.解决方案文件
2018中国CVC行业发展报告-清华五道口-2019.1-88页.pdf
org.xml.sax.SAXParseException: cvc-complex-type.2.4.a: Invalid content was found starting with element 'area'. One of '{MathWorksID, type}' is expected. 运行hosaver: Warning: Could not find an exact ...