版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/u013086062/article/details/78776282
将dubbo服务发布的时候,报了如下错误:
org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException:Line 13 in XML document from URL[jar:file:/ServiceJars/dub-service-demo.jar!/META-INF/spring/dubbo-demo-provider.xml]is invalid; nested exception is org.xml.sax.SAXParseException; lineNumber: 13;columnNumber: 82; cvc-elt.1: Cannot find the declaration of element 'beans'
错误原因:
因为服务器没有连接到外网,当不下来需要的jar包.
解决方法:
将dubbo的provider的配置文件的头文件中的路径改为classpath:的形式
之前的头文件:
<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-2.5.xsd
http://code.alibabatech.com/schema/dubbo http://code.alibabatech.com/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 classpath:/org/springframework/beans/factory/xml/spring-beans-2.0.xsd
http://code.alibabatech.com/schema/dubbo classpath:/META-INF/dubbo.xsd">
这样发布后就不会报错了..