2013-02-11 160 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"