Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot resolve the name 'repository:repository' to a(n) 'type definition' component.

I am getting this error while trying to integrate Spring Data. The full stack trace is

nested exception is org.xml.sax.SAXParseException; systemId: http://www.springframework.org/schema/data/jpa/spring-jpa.xsd; lineNumber: 18; columnNumber: 48; src-resolve: Cannot resolve the name 'repository:repository' to a(n) 'type definition' component.
at org.springframework.beans.factory.parsing.FailFastProblemReporter.error(FailFastProblemReporter.java:68)
at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:85)
at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:76)

The XML file is

<beans:beans xmlns:beans="http://www.springframework.org/schema/beans"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xmlns="http://www.springframework.org/schema/data/jpa"
        xsi:schemaLocation="http://www.springframework.org/schema/beans
        http://www.springframework.org/schema/beans/spring-beans.xsd
        http://www.springframework.org/schema/data/jpa
        http://www.springframework.org/schema/data/jpa/spring-jpa.xsd">
    <repositories base-package="com.interviewedonline.poc.repositories" />

like image 619
Ananth Duari Avatar asked Sep 23 '12 08:09

Ananth Duari


2 Answers

I had the same problem with the XSD file.

I've changed my Spring data Data Commons 1.4 to Spring Data Commons 1.3.2 and everything works perfectly fine now...

like image 97
i42 Avatar answered Sep 21 '22 04:09

i42


You need to define Spring Data JPA XML namespace first:

<?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:jpa="http://www.springframework.org/schema/data/jpa"
        xsi:schemaLocation="http://www.springframework.org/schema/beans
        http://www.springframework.org/schema/beans/spring-beans.xsd
        http://www.springframework.org/schema/data/jpa
        http://www.springframework.org/schema/data/jpa/spring-jpa.xsd">

    <jpa:repositories base-package="com.interviewedonline.poc.repositories" />

</beans>

Or if you want to use default XML namespace as in your example:

<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns="http://www.springframework.org/schema/data/jpa"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns:beans="http://www.springframework.org/schema/beans"
        xsi:schemaLocation="http://www.springframework.org/schema/beans
        http://www.springframework.org/schema/beans/spring-beans.xsd
        http://www.springframework.org/schema/data/jpa
        http://www.springframework.org/schema/data/jpa/spring-jpa.xsd">

    <repositories base-package="com.interviewedonline.poc.repositories" />

</beans:beans>
like image 23
Tomasz Nurkiewicz Avatar answered Sep 21 '22 04:09

Tomasz Nurkiewicz