12

Eclipse は、Spring のapplicationContext.xmlに次のエラーを表示しています。

cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'dwr:configuration'.   myappservlet-servlet.xml    MyApp/src/main/webapp/WEB-INF   line 23 XML Problem
cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'dwr:controller'.  myappservlet-servlet.xml    MyApp/src/main/webapp/WEB-INF   line 21 XML Problem
cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'dwr:remote'.  myappservlet-servlet.xml    MyApp/src/main/webapp/WEB-INF   line 41 XML Problem

ラインアイテムエラーの上にマウスを置くと、次のようにも表示されます。

    - schema_reference.4: Failed to read schema document 'http://www.directwebremoting.org/
 schema/spring-dwr-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:schema>であることを確認しました。<dwr:と入力してオートコンプリートを使用すると、Eclipse は<dwr:configuration><dwr:controller>などのさまざまなオプションを正しく表示します。Eclipseはスキーマを読み取らずにこれをどのように認識できますか?

問題なくさまざまな名前空間を使用しています。解決されていないのは DWR スキーマだけです。宣言は次のとおりです。

<?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:aop="http://www.springframework.org/schema/aop"
    xmlns:context="http://www.springframework.org/schema/context"
    xmlns:dwr="http://www.directwebremoting.org/schema/spring-dwr"
    xsi:schemaLocation="http://www.springframework.org/schema/beans
              http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
              http://www.springframework.org/schema/aop 
              http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
              http://www.springframework.org/schema/context
              http://www.springframework.org/schema/context/spring-context-2.5.xsd
              http://www.directwebremoting.org/schema/spring-dwr
              http://www.directwebremoting.org/schema/spring-dwr-3.0.xsd"
    default-autowire="byName">

クラスパスに最新の DWR 3.0.0.116.rc1 があります。DWR jar をクラックして開くと、以下を含むMETA-INF/spring.handlersが見つかります。

http\://www.directwebremoting.org/schema/spring-dwr=org.directwebremoting.spring.DwrAnnotationNamespaceHandler

および以下を含むMETA-INF/spring.schemas :

http\://www.directwebremoting.org/schema/spring-dwr-2.0.xsd=org/directwebremoting/spring/spring-dwr-2.0.xsd
http\://www.directwebremoting.org/schema/spring-dwr-3.0.xsd=org/directwebremoting/spring/spring-dwr-3.0.xsd

コロンのエスケープには少し気を失いましたが、すべて正しいと思います。そうしないと、全員の DWR が壊れてしまいます。

以前は、この特定のスキーマを DWR Web サイトからリアルタイムで取得していましたが、DWR サイトがダウンしたために実稼働システムがクラッシュしたときに、これに悩まされました。

4

3 に答える 3

11

ユーザー指定のカタログ投稿を Eclipse に追加してみてください。[ウィンドウ] -> [設定] -> [XML] -> [XML カタログ]で、[ユーザー指定のエントリ]を選択し、 [追加] ボタンをクリックします。

その後、スキーマの詳細を追加できます (接続が切断された場合にファイルをローカルにコピーできます)。これにより、Eclipse は検証中にスキーマにアクセスできるようになります。

于 2009-07-02T15:23:16.557 に答える
2

ここであなたの質問が何であるかわかりません。最後の段落で自分で答えているようです-DWRサイトがダウンし、Eclipseでのスキーマ検証が失敗します。Eclipse は (Spring IDE プラグインを使用しても) META-INF/spring.schemas を使用して名前空間を解決しないことに注意してください。これは Eclipse プラットフォームによって行われます。スキーマの場所でスキーマが見つからない場合、これらのエラーが発生します。

オートコンプリートに関しては、スキーマが見つからない場合でも、Eclipse はドキュメント内の既存の構造から推測してこれを提供します。

Spring は META-INF/spring.schemas ファイルを使用して JAR からスキーマを解決するため、これはアプリケーション自体の問題ではありません。

于 2009-05-25T15:58:33.577 に答える
2

これは、Eclipse をオフラインで使用する場合によくある問題です。ネットからスキーマを取得しようとしています。見つからない場合は、検証エラーを示します。

これらのエラーは無視します。オンラインに戻ったら、プロジェクトを消去してください。

于 2009-07-23T03:13:04.707 に答える