今天把在线聊天室代码改了下, 想启动应用测试. 结果抛出一大堆异常:
--------------------------------------------------------------------------------------------
org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 4 in XML document from class path resource [applicationContext.xml] is invalid; nested exception is org.xml.sax.SAXParseException: cvc-elt.1: Cannot find the declaration of element 'beans'.
这就奇怪了.上午都还是好的. 突然说Spring配置文件不对. 根据异常说的: 就是'beans'没有定义. 这可能是命名空间有问题:
-----------------------------------------------------------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
这定义是MyEclipse自动生成的. 应该不会有错吧.没办法, 只有上百度了. 几个网友也有我类似的问题. 其中一网友答案很是经典: Spring官网出了问题, 命名空间文件不能找到, 当然出问题了. 他的解决办法就是: 等Spring官网好了再试.
最后google了好几次才找到原因
- <beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://www.springframework.org/schema/beans
- classpath:/org/springframework/beans/factory/xml/spring-beans-2.0.xsd"
- default-lazy-init="true">
需要增加“classpath:/”
原帖 http://www.jnan.org/archives/2010/12/cannot-find-the-declaration-of-element-beans.html
Spring配置文件xsi:schemaLocation无法解析导致启动失败的解决方案
今天向服务器部署一个console java app之后,启动时发现程序出现异常:
Exception in thread “main” org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 10 in XML document from class path resource [app-config.xml] is invalid; nested exception is org.xml.sax.SAXParseException: cvc-elt.1: Cannot find the declaration of element ‘beans’.
然后去看看app-config.xml里的schema声明部分,是这样写的:
<beans xmlns=”http://www.springframework.org/schema/beans”
xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance”
xmlns:context=”http://www.springframework.org/schema/context”
xsi:schemaLocation=”http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd” >
很明显,有关’beans’的声明都放在http://www.springframework.org/schema/beans/spring-beans-3.0.xsd里面了。可能是网络原因,访问不倒导致解析app-config.xml失败,致使程序抛出异常。
打开spring-beans-3.0.1.RELEASE.jar一看,那个xsd文件就在org.springframework.beans.factory.xml包下面,这下子好办了,把xsd文件的引用全改为本地的就行了:
<beans xmlns=”http://www.springframework.org/schema/beans”
xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance”
xmlns:context=”http://www.springframework.org/schema/context”
xsi:schemaLocation=”http://www.springframework.org/schema/beans
classpath:/org/springframework/beans/factory/xml/spring-beans-3.0.xsd
http://www.springframework.org/schema/context
classpath:/org/springframework/context/config/spring-context-3.0.xsd” >
相关推荐
当遇到“cvc-elt.1: 找不到元素 'beans' 的声明”这种异常时,通常意味着Spring在尝试解析XML配置文件时遇到了问题。这个错误提示表明XML解析器无法找到`<beans>`元素的定义,这是一个基本的Spring配置文件结构元素...
- 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 '...
然而,有时在尝试解析这些配置文件时,可能会遇到`SAXParseException`,错误信息显示为`cvc-elt.1: 找不到元素“beans”的声明`。这个错误通常意味着Spring无法找到预期的根元素`<beans>`,这是Spring配置文件的基础...
- 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 '...
在XML Schema设计中,"cvc-complex-type.2.4.d: Invalid content was found" 是一个常见的错误信息,这通常意味着在解析XML文档时,遇到了不符合定义的复杂类型的内容。这个错误通常涉及到XML Schema的约束规则,即...
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 '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 'http:// code....
- 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 '...
计算机视觉中心-01行人数据集(CVC-01PedestrianDataset) 计算机视觉中心-01行人数据集(CVC-01PedestrianDataset)是一种用于评估行人检测算法的数据库,该数据库记录了巴塞罗那周围的行人数据,并由CVC ADAS小组...
- 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-ClinicDB 是MICCAI 2015 结肠镜视频自动息肉检测子挑战赛训练阶段的官方数据集。该数据库由从结肠镜检查视频中提取的612张静态图像组成,这些图像来自29个不同的序列。每张帧图像都附带有一个真值(ground truth...
id=$1`的请求,其中`$1`是正则表达式`(.*.)`捕获的部分。 此外,`URLRewriteFilter`还支持多种条件匹配,如请求方法(GET、POST等)、HTTP头信息、Cookie值等,以及重定向、临时重定向、设置响应头等功能,使得URL...
CVC-T 数据集是一个更广泛的数据集的测试集,称为 Endoscene。CVC-T 由从 36 名患者获得的 44 个视频序列中获得的 60 张图像组成。 一度找不到这个单独的数据集,但其实是包含在一整个医学分割网络的训练策略里的,...
PySMT提供了一个高级接口,方便用户与多种求解器进行交互,包括MathSAT、Z3、CVC4等。这个库的核心功能在于它的抽象语法树(AST)表示法,它允许对数学表达式进行操作,如构建、修改和转换,以及在不同的求解器之间...
git clone --recursive https://github.com/AILab-CVC/YOLO-World.git 克隆下来的,给大家用
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 ...