1. 程式人生 > >cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration的解決

cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration的解決

匯入了一個工程,編譯什麼的都還好,但是報了一個XML的錯誤。
cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'dubbo:application'. 


具體錯誤如下:

Multiple annotations found at this line:
    - 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>.

根據錯誤提示,有可能是http://code.alibabatech.com/schema/dubbo/dubbo.xsd這個文件找不到或者打不開,於是百度了一下,發現類似問題的問還是比較多的,比較輕鬆找到解決辦法。大致的思路是,到網上下載一個dubbo.xsd檔案,其實在dubbo的jar包裡就有,直接解壓出來就好,放到本地目錄,然後在Eclipse裡配置上關聯關係,讓Eclipse能找到這個檔案即可。

       1、下載一個dubbo.xsd檔案;
  2、在windows->preferrence->xml->xmlcatalogadd->catalog entry  ->file system 選擇剛剛下載的檔案路徑;
  3、修改key值和配置檔案的http://code.alibabatech.com/schema/dubbo/dubbo.xsd 相同儲存。
  4、在xml檔案右鍵validate就可以k解決了。

後記:有其它的xsd檔案找不到的情況,也可以按照類似的方法解決。