Spring JDO configuration parsing error

I have a spring test case which is annotated as follows

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = {"classpath:conf/allocadia-base.xml", "classpath:META-INF/jdoconfig.xml"})

      

my 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">

      

when i run the test i get

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'.

      

if i change jdoconfig to

<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">

      

mistake

Caused by: org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration issue: Unable to find spring NamespaceHandler for XML Schema Namespace [http://java.sun.com/xml/ns/jdo/jdoconfig] Resource violation: classpath resource [META-INF / jdoconfig.xml]

I am using latest spring 3.2 and JDO 2.3-e

the app works fine when I deploy it to tomcat. I just get this error when I try to run the test

+3


source to share


1 answer


Your jdoconfig.xml contains an invalid url. Try the following:

xsi:schemaLocation="http://java.sun.com/xml/ns/jdo/jdoconfig http://java.sun.com/xml/ns/jdo/jdoconfig_3_0.xsd"

      



Checking jdoconfig with wrong url

How to solve validation error for xsi: noNamespaceSchemaLocation in jdoconfig.xml

+11


source







All Articles