Cannot resolve the name 'repository:repositori

2019-07-09 07:55发布

I got an exception writing the applicationContext.xml:

org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 18 in XML document from class path resource [META-INF/applicationContext.xml] is invalid; nested exception is org.xml.sax.SAXParseException; systemId: http://www.springframework.org/schema/data/jpa/spring-jpa.xsd; lineNumber: 18; columnNumber: 51; src-resolve: Cannot resolve the name 'repository:repositories' to a(n) 'type definition' component.

After several tries I finally found the problem is that the repository:repositories resides in spring-jpa.xsd:

<xsd:extension base="repository:repositories">
<xsd:attributeGroup ref="repository:transactional-repository-attributes"/>
<xsd:attribute name="entity-manager-factory-ref" type="entityManagerFactoryRef"/>
<xsd:attribute name="enable-default-transactions" type="xsd:boolean">
<xsd:annotation><xsd:documentation>
                                Controls whether repositories get transactions enabled by default. 
</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
</xsd:extension>

After a rough look I think this has a reference to spring-repository.xsd so I guess my program simply can't find a way to the spring-repository.xsd

<xsd:complexType name="repositories">
<xsd:sequence>
...omitted..
</xsd:sequence>
</xsd:complexType>

I know that when the program tries to fetch http://www.springframework.org/schema/data/jpa/spring-jpa.xsd it goes to the spring-data-jpa.jar(I find the spring-jpa-1.8.xsd is in the package org.springframework.data.jpa.repository.config), but I'm wondering where this repository.xsd locates? How can I make sure that when sping-jpa.xsd tries to refer to repository.xsd it is successfully?

Thanks in advance

0条回答
登录 后发表回答