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

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

org.xml.sax.SAXParseException; lineNumber: 76; columnNumber: 9; cvc-complex-type.2.3: 元素 'beans' 必须不含字符 [子级], 因为该类型的内容类型为“仅元素”。
	at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:203)
	at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:134)

在编写springmvc的配置文件时

出现此错误通常是因为不规范的xxx-servlet.xml造成

如:编码问题,从别处拷贝的代码

如:如有非xml标签存在

本例的错误,是因为,xml文档里有直接中文,如代码


自动扫描
<context:component-scan base-package="net.likilone.javalaboratory.controller.init" />
显然,自动扫描 应该是注释,而我忘记加了,所以就出现了xml文档的元素错误



爆款云服务器s6 2核4G 低至0.46/天,具体规则查看活动详情Blog Img