Dubbo配置xml配置文件報紅叉 (找不到 dubbo.xsd 報錯)

在用 Dubbo 的時候,創建 xml 報錯,提示
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 找不到

方式一:

參考了這篇文章解決了這個問題:
https://www.cnblogs.com/xums/p/7801569.html


方式二:

後來,上了一下 dubbo的官網 看到了官方的例子,其中xml裏引用的xsd已經不是 http ://code.alibabatech.com/schema/dubbo/dubbo.xsd
而是 http://dubbo.apache.org/schema/dubbo/dubbo.xsd
所以,最簡單的方式就是,直接修改xml引用的xsd地址,而不用手動下載這個xsd文件,再進行配置

參考dubbo官網上的例子,修改 xml文件中,dubbo對應的這些配置即可

xmlns:dubbo="http://dubbo.apache.org/schema/dubbo"
xsi:schemaLocation="http://dubbo.apache.org/schema/dubbo http://dubbo.apache.org/schema/dubbo/dubbo.xsd"

不管方式一、方式二,當你遇到這個問題(Unable to locate Spring NamespaceHandler for XML schema namespace),你可以參考這篇文章排查下【傳送門】


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章