1. 程式人生 > >在DUBBO專案中 配置檔案出現找不到標籤而報紅叉 但專案能夠正常執行

在DUBBO專案中 配置檔案出現找不到標籤而報紅叉 但專案能夠正常執行

使用dubbo 專案的同學,大概都遇到過dubbo 配置檔案出現錯誤的情況,但是專案又能夠正常執行。

在eclipse 中錯誤如下:

- cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration 
can be found for element 'dubbo:application'.
- schema_reference.4: Failed to read schema document 'http://
code.alibabatech.com/schema/dubbo/dubbo.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>

原因:eclipse 在校驗xml 檔案 找不到 dubbo的xsd檔案。

解決方式:eclipse  windows  -   Preferences   -   XML  -    XML Catalog  點選Add新增  如下圖:

如下圖:在彈出框中  location:中找到 本地的dubbo.xsd 檔案 。如圖三,

                                  key:新增dubbo配置引用的地址。如圖四,

圖三:

解壓dubbo.jar 包 。找到dubbo.xsd  。copy 放到 一個資料夾 中(隨意放,方便圖二location設定)。。我是放到了d:\xsd資料夾

圖四: key 設定的值要和配置檔案中的一樣。