Spring应用程序上下文架构中的错误 [英] Error in spring application context schema

查看:136
本文介绍了Spring应用程序上下文架构中的错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Eclipse中有一个maven-spring项目,并且在我的spring上下文之一中有此烦人的错误消息:

I have a maven-spring project in Eclipse and I have this annoying error message in one of my spring contexts:

参考文件包含错误(jar:file:/M2_HOME/repository/org/springframework/spring-beans/3.1.2.RELEASE/spring-beans-3.1.2.RELEASE.jar!/org/springframework/beans/ factory/xml/spring-tool-3.1.xsd).有关更多信息,请在问题视图"中右键单击该消息,然后选择显示详细信息..."

Referenced file contains errors (jar:file:/M2_HOME/repository/org/springframework/spring-beans/3.1.2.RELEASE/spring-beans-3.1.2.RELEASE.jar!/org/springframework/beans/ factory/xml/spring-tool-3.1.xsd). For more information, right click on the message in the Problems View and select "Show Details..."

显示设置导致以下问题:

The show setails leads to this:

我使用的是spring-data-jpa 1.2.0.RELEASE,其余的spring jars是3.1.3RELEASE.关于spring-data-commons-core-我什至在pom中都没有对此jar的依赖,但我可以在我的m2存储库中看到它以及spring-data-commons-parent和版本1.4.0的版本. ,我不知道为什么(也许这些是spring-data-jpa的一部分?).

I using spring-data-jpa 1.2.0.RELEASE and the rest of my spring jars are 3.1.3.RELEASE. Regarding spring-data-commons-core - I don't even have a dependency to this jar in my pom but I can see it in my m2 repository along with spring-data-commons-parent and both of version 1.4.0.RELEASE, I don't know why (maybe those are part of spring-data-jpa?).

我的应用程序上下文架构:

My application context schema:

<?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:p="http://www.springframework.org/schema/p"
    xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx"
    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-3.1.xsd
   http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd
   http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.1.xsd
   http://www.springframework.org/schema/data/jpa http://www.springframework.org/schema/data/jpa/spring-jpa-1.2.xsd">

我不明白为什么我总是收到这个错误.基本上它什么都没有,应用程序可以编译,部署和运行得很好,只是Eclipse中的这个令人讨厌的红色错误标记使我发疯:)

I don't understand why I keep getting this error. Basically it has no effect what so ever, The app compiles, deployed and runs just fine, it is just this annoying red error mark in Eclipse that drives me crazy :)

推荐答案

我已经通过做三件事解决了它:

I have solved it by doing 3 things:

  1. 已将此存储库添加到我的POM中:

  1. Added this repository to my POM:

<repository>
    <id>spring-milestone</id>
    <name>Spring Maven MILESTONE Repository</name>
    <url>http://repo.springsource.org/libs-milestone</url>
</repository>

  • 我正在使用这个版本的spring-jpa:

  • I'm using this version of spring-jpa:

    <dependency>
        <groupId>org.springframework.data</groupId>
        <artifactId>spring-data-jpa</artifactId>
        <version>1.2.0.RELEASE</version>
    </dependency>
    

  • 我从上下文中删除了xsd版本(尽管我不确定是否有必要):

  • I removed the xsd versions from my context (although I'm not sure it is necessary):

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

  • 我希望这会有所帮助.

    这篇关于Spring应用程序上下文架构中的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆