2012-09-10 16 views
6

私の仕事で元従業員が残したシステムを稼動しようとしていますが、問題が発生しています。Spring XSDのアクセスエラー

XSDは、リモートアクセスによって実行された場合:

<beans xmlns="http://www.springframework.org/schema/beans" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xmlns:aop="http://www.springframework.org/schema/aop" 
    xmlns:context="http://www.springframework.org/schema/context" 
    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-3.0.xsd 
          http://www.springframework.org/schema/aop 
          http://www.springframework.org/schema/aop/spring-aop-3.0.xsd 
          http://www.springframework.org/schema/tx 
          http://www.springframework.org/schema/tx/spring-tx.xsd"> 

それが見つからない例外与える:

Failed to read schema document 'http://www.springframework.org/schema/context/spring-context-3.0.xsd', because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not <xsd:schema>. 

とXSDは、ローカルアクセスによって実行された場合:

<beans xmlns="http://www.springframework.org/schema/beans" 
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
     xmlns:aop="http://www.springframework.org/schema/aop" 
     xmlns:context="http://www.springframework.org/schema/context" 
     xmlns:tx="http://www.springframework.org/schema/tx" 
     xsi:schemaLocation="http://www.springframework.org/schema/beans 
      classpath:org/springframework/beans/factory/xml/spring-beans-3.0.xsd 
      http://www.springframework.org/schema/tx 
      classpath:org/springframework/transaction/config/spring-tx-3.0.xsd 
      http://www.springframework.org/schema/context 
      classpath:org/springframework/context/config/spring-context-3.0.xsd 
      http://www.springframework.org/schema/tool 
      classpath:org/springframework/beans/factory/xml/spring-tool-3.0.xsd"> 

それをこの例外を与えます:

C:\Users\claudiomazur>java -jar c:\temp\fin\c.jar 
0 [AWT-EventQueue-0] INFO support.ClassPathXmlApplicationContext - Refreshing org[email protected]4fa52fdf: startup date [Thu Sep 06 
11:22:59 BRT 2012]; root of context hierarchy 
45 [AWT-EventQueue-0] INFO xml.XmlBeanDefinitionReader - Loading XML bean definitions from class path resource [context.xml] 
Exception in thread "AWT-EventQueue-0" org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Unable to locate Spring NamespaceHandler for 
XML schema namespace [http://www.springframework.org/schema/context] 
Offending resource: class path resource [context.xml] 

     at org.springframework.beans.factory.parsing.FailFastProblemReporter.error(FailFastProblemReporter.java:68) 

この問題を解決するにはいくつかのアイデアですか?

ビッグハグ!!

+0

に? – user1516873

+0

私はこれについて考えていない。 – claudioivp

答えて

9

Spring XDSはSpring Jarsで定義され、出荷されています!例えば、spring-context.jarにはspring-context-3.0.xsdが含まれています。 (spring-context.jar/META-INF/spring.schema)

プロジェクト内にこのjarファイルがあることを確認してください。

「リモート」と呼ばれるものは、実際にはリモートではありません。そして、私はあなたが "ローカルアクセス"と呼んだものを見たことがないので、なぜリモートの(リモートではない)ものがすべてのxsdsで動作するのか、スプリングコンテキストで動作するのかを調べようとします。


それはデスクトッププログラムであり、あなたが他のすべての爆発のjarファイルを含む単一のjarファイルを使用する場合、あなたは別の春-XXXからのシングルspring.handlersspring.schamesファイルの内容という世話をする必要があります.jarは(2つの) "hunge"ファイルにまとめられています。最終的に、この(2つの)ファイルにはすべてのスキーマ名とハンドラ名が含まれています。

+0

は私が考えてはい、この依存性: ' code' org.springframework' user1618606 @ – claudioivp

+0

をcode' 3.0.6.RELEASE 春コンテキスト:私は本当にチェックを意味します!このファイルがサーバー上に展開されているWAR内にあることを確認してください – Ralph

+0

はい...それは完全なパスです:C:\ Users \ claudiomazur \ .m2 \ repository \ org \ springframework \ spring-context \ 3.0.6.RELEASE \ spring-context-3.0.6.RELEASE.jar – claudioivp

2

try wget http://www.springframework.org/schema/context/spring-context-3.0.xsdを実行してください。

should be something like: wget http://www.springframework.org/schema/context/spring-context-3.0.xsd 
--2012-09-10 15:56:05-- http://www.springframework.org/schema/context/spring-context-3.0.xsd 
Resolving www.springframework.org... 205.140.197.88 
Connecting to www.springframework.org|205.140.197.88|:80... connected. 
HTTP request sent, awaiting response... 200 OK 
Length: 19651 (19K) [text/xml] 
Saving to: “spring-context-3.0.xsd” 

100%[=====================================================================>] 19,651  24.6K/s in 0.8s  

2012-09-10 15:56:06 (24.6 KB/s) - “spring-context-3.0.xsd” saved [19651/19651] 

xsdスキーマの取得に問題がある場合は、このスキーマを継承したxmlファイルを使用するのが難しくなります。

2番目のケースでは、classpathにはspring - * - 3.0.xsdファイルがありません。

+0

@Ralphはい、あなたはリグです。しかし問題行動で説明されるのは通常ではありません。パーサーのように見えますが、 – user1516873

+0

で定義されているものを使用していません。申し訳ありませんが、自分の答えを正しく読まなかったので、xsdファイルをチェックすることをお勧めします。 – Ralph

+0

私はすべてのインターネット保護を無効にしていますが、今はxsdにアクセスしています...しかし最後の例外があります: のSpring NamespaceHandlerを見つけることができません[http://www.springframework.org/schema/context ] リソースの不具合:class path resource [context.xml] – claudioivp

3

スプリングXSDがジャーと一緒に出荷されたことは事実です。

これらのXSDのが格納されている情報:

  1. は、XMLファイルに貸し付けは、「我々は、豆の名前空間を使用していると、私たちは、ファイルを確認してください

    xsi:schemaLocation="http://www.springframework.org/schema/beans 
    http://www.springframework.org/schema/beans/spring-beans.xsd 
    
  2. を検討する必要がありますspring-schemas "META-INFフォルダのspring-beans-4.0.1.RELEASE.jar。このファイルから サンプルコンテキストは次のようになります。したがって

    http\://www.springframework.org/schema/beans/spring-beans-4.0.xsd 
    =org/springframework/beans/factory/xml/spring-beans-4.0.xsd 
    
    http\://www.springframework.org/schema/beans/spring-beans.xsd 
    =org/springframework/beans/factory/xml/spring-beans-4.0.xsd 
    
  3.  http\://www.springframework.org/schema/beans/spring-beans.xsd is mapped to  
        org/springframework/beans/factory/xml/spring-beans-4.0.xsd 
    

    あなたのjar何のXMLパーサは、アプリケーションで使用する