2013-02-11 158 views
3

Eclipse/STS一起使用Spring 3.2.1和Spring-data-jpa報告錯誤。 我有下面的頭有些XML配置文件:Spring-Data-JPA在使用XML配置的Spring STS中導致XSD驗證錯誤

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

我使用Spring 3.2.1與Spring-數據JPA 1.3.0和Eclipse/STS報告這種:

引用文件包含錯誤 (http://www.springframework.org/schema/data/jpa

這發生在包含數據JPA架構中的每個單獨的XML配置文件。 當我從XML配置中刪除JPA時,一切都很好。

我的配置錯了嗎?

謝謝! 保羅

+0

我得到同樣的東西。我懷疑這是因爲spring 3.2依賴項導入spring-tool-3.2和spring數據xsd導入spring-tool.xsd(沒有3.2後綴)。仍然不知道如何解決它,雖然 – 2013-03-20 08:45:38

+0

這可能有助於http://stackoverflow.com/questions/13693065/error-in-spring-application-context-schema – 2013-03-20 08:46:57

回答

6

今天還沒有一個http://www.springframework.org/schema/data/jpa/spring-jpa.xml文件,你可以使用http://www.springframework.org/schema/data/jpa/spring-jpa-1.3.xsd,但這個文件使用http://www.springframework.org/schema/data/repository/spring-repository.xsd所以你必須添加在您的環境文件這一模式的位置不存在太:

xsi:schemaLocation="http://www.springframework.org/schema/beans 
        http://www.springframework.org/schema/beans/spring-beans.xsd 
        http://www.springframework.org/schema/jdbc 
        http://www.springframework.org/schema/jdbc/spring-jdbc-3.2.xsd 
        http://www.springframework.org/schema/data/jpa 
        http://www.springframework.org/schema/data/jpa/spring-jpa-1.3.xsd 
        http://www.springframework.org/schema/data/repository 
        http://www.springframework.org/schema/data/repository/spring-repository-1.5.xsd 
        http://www.springframework.org/schema/jee 
        http://www.springframework.org/schema/jee/spring-jee-3.2.xsd"