建的dubbo项目找不到dubbo:application,是什么原因

新建分布式dubbo的maven项目,pom.xml报错,不知道什么原因,求各位大佬帮忙看看!谢谢了!

<?xml version="1.0" encoding="UTF-8"?>
xmlns:context="http://www.springframework.org/schema/context"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:dubbo="http://code.alibabatech.com/schema/dubbo"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.2.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.2.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.2.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.2.xsd
http://code.alibabatech.com/schema/dubbo http://code.alibabatech.com/schema/dubbo/dubbo.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-4.2.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd">

    <dubbo:application name="taotao-manager" />//报错位置一:
    <dubbo:registry protocol="zookeeper" address="192.168.25.128:2181" />//报错位置二:
    <dubbo:protocol name="dubbo" port="20880" />//报错位置三:


    报了错误;
    ![图片说明](https://img-ask.csdn.net/upload/201812/02/1543751065_758870.jpg)
    第一个报错:
    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>.
 第二个报错:
 cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'dubbo:registry'.
 第三个报错:
 cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'dubbo:protocol'.

1个回答

好 了!嘿嘿!
解决办法:
1)下载dubbo的jar包,比如:dubbo-2.5.3.jar,解压能获取到dubbo.xsd
2)在eclipse中导入文件dubbo.xsd:
windows->preferrence->xml->xmlcatalog,
add->catalog entry ->file system 选择文件dubbo.xsd
添加后,Key默认是这样的:http://code.alibabatech.com/schema/dubbo

3)修改key值为:
http://code.alibabatech.com/schema/dubbo/dubbo.xsd,因为xml配置文件中xsi:schemaLocation的也是这个值,保持一致,重新validate,异常消失

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问
相关内容推荐