2012-12-03 7 views
12

私は、Eclipseでのmaven-春のプロジェクトを持っていると私は私の春のコンテキストのいずれかで、この迷惑なエラーメッセージを表示しています。ファイル::エラーが

参照されるファイルは、エラー(jarファイルが含まれています/ M2_HOME /リポジトリ/ 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)を参照してください。詳細については、右の問題ビューでメッセージをクリックして選択し、「詳細の表示を...」

ショーsetailsはこれにつながる:私は春-DATA-使用

enter image description here

jpa 1.2.0.RELEASEと私の春の瓶の残りは3.1.3.RELEASEです。 spring-data-commons-coreに関して - 私は自分のpomでこのjarファイルに依存することさえありませんが、私はsq-data-commons-parentとバージョン1.4.0.RELEASEの両方と共に私のm2リポジトリで見ることができますなぜか分からない(おそらくそれらは春データの一部です)。

私のアプリケーションのコンテキストスキーマ:

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

私はこのエラーを取得しておく理由を私は理解していません。基本的に、それはそう、これまで、アプリが展開され、コンパイルし、うまく動作しますどのような効果がありません、それは狂気:)

答えて

11

私は3つの事をすることによってそれを解決してきた私を駆動し、Eclipseでちょうどこの迷惑な赤いエラーマークは次のとおりです。

  1. 私のPOMにこのリポジトリを追加しました:

    <repository> 
        <id>spring-milestone</id> 
        <name>Spring Maven MILESTONE Repository</name> 
        <url>http://repo.springsource.org/libs-milestone</url> 
    </repository> 
    
  2. 私は春-JPAのこのバージョンで使用しています:

    <dependency> 
        <groupId>org.springframework.data</groupId> 
        <artifactId>spring-data-jpa</artifactId> 
        <version>1.2.0.RELEASE</version> 
    </dependency> 
    
  3. (私はそれが必要であるか分からないが)、私は私のコンテキストからの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: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"> 
    

私はこのことができます願っています。

+0

夢のような作品は、mongodbでも似ています! (いくつかのトリックで)。私はそれを別の答えとして追加しました、ありがとう! – tugcem

+0

それを聞いてうれしいです:) – forhas

3
私は最近、JPA-1.3

何も私はこのような明示的なtools.xsdリンク

xsi:schemaLocation=" ... 
    http://www.springframework.org/schema/tool 
    http://www.springframework.org/schema/tool/spring-tool-3.2.xsd 
    ... "> 

使用するまで働いていないと同じ問題があった

<?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:tx="http://www.springframework.org/schema/tx" 
    xmlns:jdbc="http://www.springframework.org/schema/jdbc" 
    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.2.xsd 
     http://www.springframework.org/schema/tx 
     http://www.springframework.org/schema/tx/spring-tx-3.2.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/tool 
     http://www.springframework.org/schema/tool/spring-tool-3.2.xsd 
     "> 
+0

Springのコンテキストで同じ問題が発生しました。それを解決しました。興味深いことに、http://www.springframework.org/schema/context/spring-context-4.2.xsd 4.1スプリングツール – borjab

6

私は春にやった何を-data-jpa-1.3はxsdにバージョンを追加して1.2に下げました。その後、エラーメッセージが消えます。このように

<beans 
     xmlns="http://www.springframework.org/schema/beans" 
     ... 
     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-1.2.xsd"> 

1.2のために修正されたようですが、1.3に再び表示されます。

+0

+1へのリンクは、古いスキーマを使用しても私のために働いた。 – elias

3

何が@forhasと@HRgigerも私のために働いていました。私はjpaの代わりにspring-data-mongodbを使用しています。

しかし、mongodbバインディングの場合は、mongodbリファレンスxsdのバージョンを削除しないでください。バージョン:http://www.springframework.org/schema/data/mongo/spring-mongo-1.0.xsdのままにしてください。 contextbeansのバージョンを削除する必要があります。

16

私は最近最近のEclipse(Kepler)で同様の問題を抱えていましたが、環境設定> XML> XMLファイル>検証でオプション「すべてのXMLスキーマの場所を尊重します。 異なるスキーマの場所を指す同じ名前空間への参照の検証を無効にします。検証されるXMLファイルで最初に見つかったものだけを使用します。このオプションは、Xercesライブラリからのものです。

WTPドク:http://www.eclipse.org/webtools/releases/3.1.0/newandnoteworthy/sourceediting.php

Xercesのドク:http://xerces.apache.org/xerces2-j/features.html#honour-all-schemaLocations

+0

は私にとってもEclipse 3で働いていました。7 – Brian

+0

は、Springの混乱したプロジェクトのEclipse Marsで動作します –

4

私は最近、春4.0と同じ問題がありました。

名前の衝突が原因で発生したのは、spring-beans-4.0.xsdspring-context-4.0.xsdです。 オープニングspring-context-4.0.xsdあなたはspring-beans-4.0.xsdは以下のようにインポートされていることがわかります。

<xsd:import namespace="http://www.springframework.org/schema/beans" 
schemaLocation="http://www.springframework.org/schema/beans/spring-beans-4.0.xsd"/> 

これらの名前の衝突はEclipseが文句を言う作る「...同じ名前の2つのグローバル要素を含めることはできませんスキーマ...」

注目すべき点は、私はEclipse Kepler SR2ではなく、Eclipse Luna SR1でこの問題を抱えていなかったことです。これは、XML検証に関する両方の設定を比較しても同じです。

は、それは、XSIから春コンテキスト-4.0.xsdを削除することによって解決された:schemaLocation属性:

http://www.springframework.org/schema/context 
http://www.springframework.org/schema/context/spring-context-4.0.xsd 

このすべてが期待されるように働いた後。

+1

あなたが使用している場合、問題は解決しません。 問題。 –

2

時には、spring config xmlファイルは、次のEclipseが開いてもうまくいきません。

スキーマ定義によって引き起こされたxmlファイルのエラーを示します。再オープンしても、プロジェクトをクリーンアップしても、クリーンアップしても機能しません。

でも試してみてください!

spring config xmlファイルを右クリックし、validateを選択します。

しばらくすると、エラーが表示されなくなり、eclipseはこのファイルにエラーがないことを通知します。

どういう冗談...

+0

それは私のためにそれをした、ありがとう。 – Bevor