3
我有一个注释如下弹簧测试用例春JDO配置解析错误
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = {"classpath:conf/allocadia-base.xml", "classpath:META-INF/jdoconfig.xml"})
我jdoconfig是
<?xml version="1.0" encoding="utf-8"?>
<jdoconfig xmlns="http://java.sun.com/xml/ns/jdo/jdoconfig"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://java.sun.com/xml/ns/jdo/jdoconfig">
当我运行测试,我得到
java.lang.IllegalStateException: Failed to load ApplicationContext
.
.
.
Caused by: org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 4 in XML document from class path resource [META-INF/jdoconfig.xml] is invalid; nested exception is org.xml.sax.SAXParseException: cvc-elt.1: Cannot find the declaration of element 'jdoconfig'.
如果我将jdoconfig更改为
<jdoconfig xmlns="http://java.sun.com/xml/ns/jdo/jdoconfig"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/jdo/jdoconfig http://java.sun.com/xml/ns/jdo/jdoconfig_2_3.xsd">
误差
产生的原因: org.springframework.beans.factory.parsing.BeanDefinitionParsingException: 配置问题:找不到春天NamespaceHandler为 XML schema命名空间[HTTP:// java的。 sun.com/xml/ns/jdo/jdoconfig] 违犯的资源:类路径资源[META-INF/jdoconfig.xml]
我使用最新的弹簧3.2和2.3 JDO-E
当我将它部署到tomcat时,应用程序正常工作我刚刚尝试运行测试时出现此错误