9

Spring Dataを統合しようとすると、このエラーが発生します。フルスタックトレースは

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)

XMLファイルは

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

4

6 に答える 6

2

XSDファイルでも同じ問題が発生しました。

Spring data DataCommons1.4をSpringDataCommons 1.3.2に変更しましたが、すべてが正常に機能するようになりました...

于 2013-02-05T13:53:59.407 に答える
1

最初にSpringDataJPAXML名前空間を定義する必要があります。

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

または、例のようにデフォルトのXML名前空間を使用する場合:

<?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>
于 2012-09-23T08:03:10.423 に答える
1

同じエラーが発生しました。追加spring-data-commons-coreすることで問題が解決したようです。

于 2012-10-02T05:11:44.670 に答える
1

このjarファイルを追加しましたspring-data-commons-core-1.2.1.RELEASE

Pom.xmlに以下のエントリを追加しました

<dependency>
     <groupId>org.springframework.data</groupId>
     <artifactId>spring-data-commons-core</artifactId>
     <version>1.2.1.RELEASE</version>
</dependency>

jpa configuratorファイルで、xsi:schemaLocationhttp://www.springframework.org/schema/data/jpahttp://www.springframework.org/schema/data/jpa/spring-jpa-1.2の下に以下のエントリを追加しまし 。 xsd

于 2013-01-29T03:29:03.257 に答える
1

最近、古いプロジェクトの依存関係を更新するときにこのエラーが発生しました。私が抱えていた問題は、この依存関係でした。

<dependency>
  <groupId>org.springframework.data</groupId>
  <artifactId>spring-data-commons-core</artifactId>
  <version>1.5.1.RELEASE</version>
</dependency>

名前が変更され、正しいものは

<dependency>
  <groupId>org.springframework.data</groupId>
  <artifactId>spring-data-commons</artifactId>
  <version>1.8.1.RELEASE</version>
</dependency>

spring-data-commons-corespring-data-commonsはdata-mongodbの推移的な依存関係であると宣言したため、両方のjarになり、クラスローダーは正しくないspring-data-commons-coreを使用していました。

于 2014-07-09T08:50:44.300 に答える
0

一部のSpring.jarファイルには、META-INFフォルダーがあります。そのフォルダーには、spring.handlersとspring.schemasがあります。spring-data-commons- .jarにはあります。Mavenを使用する場合は、src / main / resourcesの下にMETA-INFフォルダーを作成し、spring-data-commons- .jarのspring.handlers、spring.schemasのコンテンツをspring.handlers、spring.schemasに追加する必要があります。

頑張ってください!

于 2013-09-17T07:33:45.720 に答える