I would like to use the Spring Data Populator, but I am getting the SAXParseException
:
Exception in thread "main"
org.springframework.beans.factory.parsing.BeanDefinitionParsingException:
Configuration problem: Failed to import bean definitions from URL location
[classpath*:spring-context/dbContext.xml]
Offending resource: class path resource [spring-context/applicationContext.xml];
nested exception is org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException:
Line 64 in XML document from URL [file:/home/pi/Workspace/AGServer/bin/spring-context/dbContext.xml] is invalid;
nested exception is org.xml.sax.SAXParseException: cvc-complex-type.3.2.2:
Attribute 'location' is not allowed to appear in element 'repository:jackson-populator'.
My main server class is:
public final class ServerMain {
private static final String APP_CONTEXT_XML = "spring-context/applicationContext.xml";
public static void main(final String[] args) {
final ConfigurableApplicationContext context = new ClassPathXmlApplicationContext(APP_CONTEXT_XML);
context.registerShutdownHook();
}
}
The applicationContext.xml loads other sub-files and looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<beans
xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:aop="http://www.springframework.org/schema/aop"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">
<import resource="classpath*:spring-context/serverContext.xml" />
<import resource="classpath*:spring-context/dbContext.xml" />
<import resource="classpath*:spring-context/jettyContext.xml" />
</beans>
And finally, the beginning of the dbContext.xml from where I invoke the Populator
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:repository="http://www.springframework.org/schema/data/repository"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jpa="http://www.springframework.org/schema/data/jpa"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/data/jpa http://www.springframework.org/schema/data/jpa/spring-jpa.xsd
http://www.springframework.org/schema/data/repository http://www.springframework.org/schema/data/repository/spring-repository.xsd">
<!-- AUTH DS / PU / TX / SERVICE -->
<!-- the repositories configuration, ommited for clarity -->
<repository:jackson-populator location="classpath:auth.json" />
May that be caused somehow by conflicts with spring-beans-3.0.xsd? I saw in all (though not too many, e.g. here: http://docs.spring.io/spring-data/commons/docs/1.5.1.RELEASE/reference/htmlsingle/???#d0e893) documents that spring-beans.xsd, without any release id is used. I tried to change it, but that didn't help.