Maven创建dubbo项目-dubbo配置文件错误

在创建dubbo项目,引用xml文件时,首先需要引入这几个xml文件 

1)xmlns:dubbo="http://code.alibabatech.com/schema/dubbo"; 

2)http://code.alibabatech.com/schema/dubbo;\

3)http://code.alibabatech.com/schema/dubbo/dubbo.xsd "

但是当我们配置dubbo的时候,如 

 ,

会提示这些错误:

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:module'. 
- 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 .

问题在于Eclipse没有识别出相应的标签,解决办法如下:

1、选择elcipse的window-->preferences,弹出相应对话框,选择xml catalog 选择add;

Maven创建dubbo项目-dubbo配置文件错误_第1张图片

2、 弹出的对话框如下;

Maven创建dubbo项目-dubbo配置文件错误_第2张图片

Location: 即为我们的dubbo.xsd文件,可以在dubbo的jar包中解压获得,路径实例:D:\Program Files\Repository\Maven\com\alibaba\dubbo\2.5.3\dubbo-2.5.3\META-INF
Key Type: Schema Location
Key:      http://code.alibabatech.com/schema/dubbo/dubbo.xsd
3、点击ok,项目右键Validate;

4、Validate的时候可能会出现error,此时右键工程,选择properties,选择Validation,如下所示:

Maven创建dubbo项目-dubbo配置文件错误_第3张图片

勾选Enable project specific settings选框,点击Disable All,再点击OK关闭窗口;

5、项目右键Validate,成功。


你可能感兴趣的:(Maven创建dubbo项目-dubbo配置文件错误)