dubbo项目报错:
Unable to locate Spring NamespaceHandler for XML schema namespace [http://dubbo.apache.org/schema/dubbo]
dubbo依赖配置:
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>dubbo</artifactId>
<version>2.5.3</version>
</dependency>
dubbo.xml配置
<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:dubbo="http://dubbo.apache.org/schema/dubbo"
xmlns="http://www.springframework.org/schema/beans"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.3.xsd
http://dubbo.apache.org/schema/dubbo http://dubbo.apache.org/schema/dubbo/dubbo.xsd">
原因就是dubbo的jar包和xml中使用的对应的命名空间不匹配。
因为dubbo已经捐献给了apache,但是alibab的dubbo包类依然在各大maven仓库。但是通常我们开发时都会去[dubbo官网](http://dubbo.apache.org/en-us/) 去查看资料,但是所有资料已经是apache相关的命名,包含dubbo源码的package名称。
解决:
将xml中的dubbo的xsd改下:
xmlns:dubbo="http://dubbo.apache.org/schema/dubbo"
改成:
xmlns:dubbo="http://code.alibabatech.com/schema/dubbo"
http://dubbo.apache.org/schema/dubbo http://dubbo.apache.org/schema/dubbo/dubbo.xsd
改成
<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:dubbo="http://code.alibabatech.com/schema/dubbo"
xmlns="http://www.springframework.org/schema/beans"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.3.xsd
http://code.alibabatech.com/schema/dubbo http://code.alibabatech.com/schema/dubbo/dubbo.xsd">