关于dubbo创建服务和引用服务时报错:The matching wildcard is strict, but no declaration can be found for element ..

场景:

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,作为一个SOA架构的项目,分为表现层与服务层,自然地,为了各个层之间解耦合(或者最大限度地松耦合),我们使用了dubbo这样一个alibaba开源的分布式服务框架,该框架最大的特点就是利用分层的方式来架构,从服务模型的角度来看,Dubbo采用的是一种非常简单的模型,要么是提供方提供服务,要么是消费方消费服务,所以基于这一点可以抽象出服务提供方(Provider)和服务消费方(Consumer)两个角色。

但是在appplication-context-service.xml创建服务和在springmvc中引用服务时,我们设置了dubbo约束,但是仍然会报错,系统提示我们找不到dubbo:application、dubbo:registry、dubbo:reference等元素,这就说明系统没有找到dubbo.xsd,于是我手动添加dubbo.xsd

添加方法如下:


这里是手动导入dubbo.xsd的步骤,之前我在导入的时候,每次都会忘记第7步,即要在key的原有路径上加上dubbo.xsd。一定要记着!!!

最后maven update即可。千万注意

转自:https://blog.csdn.net/wallace1992/article/details/77801583

猜你喜欢

转载自blog.csdn.net/yzg_666/article/details/80390572