使用dubbo时spring配置中dubbo配置报错解决方法
在eclipse下 使用阿里dubbo分布式框架时,在配置dubbo配置之后,该配置文件会报错,错误如下:
错误信息如下:
1 2 3 4 |
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>. |
报错原因是因为我们对于配置dubbo.xsd约束文件
在eclipse中添加dubbo.xsd文件的配置,步骤如下
windows->preferrence->xml->xml Catalog
add->catalog entry ->file system
点击file System选择dubbo.xsd文件
设置Location后,设置key值(一定要设置)
key值:http://code.alibabatech.com/schema/dubbo/dubbo.xsd
然后点击OK
然后在xml文件右键选择validate 或清理项目重新构建
然后错误的小红叉就消失不见了。
附件:dubbo.xsd
参考资料:
https://blog.csdn.net/guishengbin/article/details/71942829