无法加载dubbo.xsd/Failed to read schema document ‘http://code.alibabatech.com/schema/dubbo/dubbo.xsd

项目中需要使用阿里的dubbo,开发中发现Failed to read schema document ‘http://code.alibabatech.com/schema/dubbo/dubbo.xsd’。上网百度发现别人说阿里开源网站http://code.alibabatech.com,挂掉有好几个月了,距离现在一年多了,然后在代码中按住ctrl将鼠标悬停在网址上进行访问发现的确访问不了。

报错:

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>.

Spring配置文件:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
	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://code.alibabatech.com/schema/dubbo http://code.alibabatech.com/schema/dubbo/dubbo.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://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-4.2.xsd">

我们都知道Spring在启动时是要检验XML文件的,而Spring在加载dubbo时,会从dubbo的jar里加载dubbo.xsd

缺少这个文件所以xml验证会报错。


解决方案:

进入maven 的仓库 com/alibaba/dubbo 解压dubbo-2.5.3.jar
在dubbo-2.5.3文件夹下面的META-INF 里面有dubbo.xsd.

第四步点击File system选中本地dubbo.xsd文件即可。


配置成功后选中spring的配置文件,选择validate,进行xml重新验证。



  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值