Dubbo配置xml配置文件报红叉 (找不到 dubbo.xsd 报错)

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_31772441/article/details/82531359

在用 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),你可以参考这篇文章排查下【传送门】


猜你喜欢

转载自blog.csdn.net/qq_31772441/article/details/82531359