DUBBO: xml文件无法解析
xml是:
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dubbo="http://code.alibabatech.com/schema/dubbo"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://code.alibabatech.com/schema/dubbo http://code.alibabatech.com/schema/dubbo/dubbo.xsd"> <dubbo:application name="platform_system_provider" owner="platform_system_provider" organization="llk" logger="slf4j" /> ...
java
package com.example.test_dubbo; import org.apache.commons.collections.map.MultiValueMap;
import org.springframework.beans.MutablePropertyValues;
import org.springframework.beans.PropertyValue;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.beans.factory.xml.XmlBeanFactory;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.core.io.FileSystemResource; import java.util.*; public class DubboXmlDetectorL { public static void main(String[] args) { String dubboXML = "E:\\dev\\erdp2\\erdp_system\\erdp_system_app\\src\\main\\resources\\dubbo.xml";
String dubboXML2 = "E:\\dev\\ppm\\platform_system\\02_Src\\platform_system\\platform_system_provider\\src\\main\\resources\\dubbo-provider.xml";
compareDubboXml(dubboXML, dubboXML2);
} private static void compareDubboXml(String dubboXML, String dubboXML2) {
System.out.println("left = " + dubboXML);
Set list1 = getDobboXml(dubboXML);
System.out.println("right = " + dubboXML2);
Set list2 = getDobboXml(dubboXML2); System.out.println("left = " + list1);
System.out.println("right = " + list2); Set set2 = new HashSet(list1);
list1.removeAll(list2);
System.out.println("list111 = " + list1); list2.removeAll(set2);
System.out.println("list222 = " + list2); } private static Set getDobboXml(String dubboXML) {
XmlBeanFactory xmlBeanFactory = new XmlBeanFactory(new FileSystemResource(dubboXML));
String[] beanDefinitionNames = xmlBeanFactory.getBeanDefinitionNames(); MultiValueMap multiValueMap = new MultiValueMap();
for (int i = ; i < beanDefinitionNames.length; i++) {
String beanDefinitionName = beanDefinitionNames[i];
BeanDefinition beanDefinition = xmlBeanFactory.getBeanDefinition(beanDefinitionName);
Class<? extends BeanDefinition> aClass = beanDefinition.getClass(); Object anInterface = beanDefinition.getAttribute("interface");
// System.out.println("anInterface = " + anInterface);
MutablePropertyValues propertyValues = beanDefinition.getPropertyValues();
PropertyValue anInterface1 = propertyValues.getPropertyValue("interface"); if (anInterface1 != null) {
String interfaceProp = (String) anInterface1.getValue();
PropertyValue version = propertyValues.getPropertyValue("version");
PropertyValue group = propertyValues.getPropertyValue("group"); String key = interfaceProp;//+":"+ (version==null?"":version.getValue())+ ":" + (group==null?"":group.getValue());
if (multiValueMap.containsKey(key)) { }
multiValueMap.put(key, beanDefinitionName);
} } Set set = multiValueMap.entrySet();
for (Iterator iterator = set.iterator(); iterator.hasNext(); ) {
Object entry = iterator.next();
if (entry instanceof Map.Entry) {
ArrayList value = (ArrayList) ((Map.Entry) entry).getValue();
if (value.size() > ) {
System.out.println(" = " + entry );
}
}
} return multiValueMap.keySet();
} private static void test1() {
String xmls = "E:\\dev\\erdp2\\erdp_discuss\\erdp_discuss_app\\src\\main\\resources\\dubbo.xml\n" +
"E:\\dev\\erdp2\\erdp_doc\\erdp_doc_app\\src\\main\\resources\\dubbo.xml\n" +
"E:\\dev\\erdp2\\erdp_project\\erdp_project_app\\src\\main\\resources\\dubbo.xml\n" +
"E:\\dev\\erdp2\\erdp_scheduler\\erdp_scheduler_app\\src\\main\\resources\\dubbo.xml\n" +
"E:\\dev\\erdp2\\erdp_system\\erdp_system_app\\src\\main\\resources\\dubbo.xml\n" +
"E:\\dev\\erdp2\\erdp_workflow\\erdp_workflow_app\\src\\main\\resources\\dubbo.xml";
String[] split = xmls.split("\n");
for (int i = ; i < split.length; i++) {
String s = split[i];
System.out.println("XML = " + s);
detectDobboXml(s);
} String dubboXML = "E:\\dev\\erdp2\\erdp_doc\\erdp_doc_app\\src\\main\\resources\\dubbo.xml";
dubboXML = "dubbo.xml";
dubboXML = "E:\\dev\\erdp2\\test_nacos\\src\\test\\java\\dubbo.xml";
// detectDobboXml(dubboXML);
} private static void detectDobboXml(String dubboXML) {
XmlBeanFactory xmlBeanFactory = new XmlBeanFactory(new FileSystemResource(dubboXML));
String[] beanDefinitionNames = xmlBeanFactory.getBeanDefinitionNames(); // DefaultListableBeanFactory bdr = new DefaultListableBeanFactory();
// bdr.set
// XmlBeanDefinitionReader xmlBeanDefinitionReader = new XmlBeanDefinitionReader(bdr);
// NamespaceHandlerResolver namespaceHandlerResolver = xmlBeanDefinitionReader.getNamespaceHandlerResolver();
// System.out.println("namespaceHandlerResolver = " + namespaceHandlerResolver);
// NamespaceHandlerResolver nsr = new DefaultNamespaceHandlerResolver();
// xmlBeanDefinitionReader.setNamespaceHandlerResolver(nsr); MultiValueMap multiValueMap = new MultiValueMap();
for (int i = ; i < beanDefinitionNames.length; i++) {
String beanDefinitionName = beanDefinitionNames[i];
// System.out.println("beanDefinitionName = " + beanDefinitionName);
BeanDefinition beanDefinition = xmlBeanFactory.getBeanDefinition(beanDefinitionName);
// System.out.println("beanDefinition = " + beanDefinition);
Class<? extends BeanDefinition> aClass = beanDefinition.getClass(); Object anInterface = beanDefinition.getAttribute("interface");
// System.out.println("anInterface = " + anInterface);
MutablePropertyValues propertyValues = beanDefinition.getPropertyValues();
PropertyValue anInterface1 = propertyValues.getPropertyValue("interface");
// System.out.println("anInterface1 = " + anInterface1);
// propertyValues.getPropertyValueList(); if (anInterface1 != null) {
String interfaceProp = (String) anInterface1.getValue();
PropertyValue version = propertyValues.getPropertyValue("version");
PropertyValue group = propertyValues.getPropertyValue("group"); String key = interfaceProp+":"+ (version==null?"":version.getValue())+ ":" + (group==null?"":group.getValue());
// System.out.println("aClass = " + aClass);
if (multiValueMap.containsKey(key)) {
// multiValueMap.put(interfaceProp, beanDefinitionName);
// System.out.println("beanDefinitionName = " + beanDefinitionName + " interface = " + interfaceProp);
// System.out.println(" interface = " + interfaceProp + " beanDefinitionNames = " + multiValueMap.get(interfaceProp));
}
multiValueMap.put(key, beanDefinitionName);
// multiValueMap.put(interfaceProp, aClass);
} } // Object dubbo = xmlBeanFactory.getBean("dubbo");
// System.out.println("dubbo = " + dubbo);
// BeanDefinition dubbo1 = xmlBeanFactory.getBeanDefinition("dubbo");
// System.out.println("dubbo1 = " + dubbo1.getClass()); Set set = multiValueMap.entrySet();
for (Iterator iterator = set.iterator(); iterator.hasNext(); ) {
Object entry = iterator.next();
// System.out.println("entry = " + entry + " v " + multiValueMap.get(entry));
if (entry instanceof Map.Entry) {
ArrayList value = (ArrayList) ((Map.Entry) entry).getValue();
// System.out.println("value = " + value.size());
if (value.size() > ) {
System.out.println(" = " + entry );
}
}
// Collection collection = multiValueMap.getCollection(entry);
// if (collection != null && collection.size() > 1) {
// System.out.println("key = " + entry);
// dumpCollection(collection);
// }
} // Collection values = multiValueMap.values();
// System.out.println("values = " + values);
} private static void dumpCollection(Collection values) {
for (Iterator iterator = values.iterator(); iterator.hasNext(); ) {
Object next = iterator.next();
System.out.println("next = " + next);
}
} private static void test() {
String dubboXML = "E:\\dev\\erdp2\\erdp_doc\\erdp_doc_app\\src\\main\\resources\\dubbo.xml";
dubboXML = "dubbo.xml";
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(
new String[]{dubboXML});
context.start(); ConfigurableListableBeanFactory beanFactory = context.getBeanFactory();
String[] beanDefinitionNames = beanFactory.getBeanDefinitionNames();
for (int i = ; i < beanDefinitionNames.length; i++) {
String beanDefinitionName = beanDefinitionNames[i];
System.out.println("beanDefinitionName = " + beanDefinitionName);
}
}
}
出现错误:dubbo 通配符的匹配很全面, 但无法找到元素 'dubbo:service' 的声明。
::44.125 [main] WARN o.s.b.f.xml.XmlBeanDefinitionReader - Ignored XML validation warning
org.xml.sax.SAXParseException: schema_reference.: 无法读取方案文档 'http://code.alibabatech.com/schema/dubbo/dubbo.xsd', 原因为 ) 无法找到文档; ) 无法读取文档; ) 文档的根元素不是 <xsd:schema>。
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:)
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.warning(ErrorHandlerWrapper.java:)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:)
at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.reportSchemaErr(XSDHandler.java:)
at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.reportSchemaWarning(XSDHandler.java:)
at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.getSchemaDocument1(XSDHandler.java:)
at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.getSchemaDocument(XSDHandler.java:)
at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.parseSchema(XSDHandler.java:)
at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaLoader.loadSchema(XMLSchemaLoader.java:)
at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.findSchemaGrammar(XMLSchemaValidator.java:)
at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.handleStartElement(XMLSchemaValidator.java:)
at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.emptyElement(XMLSchemaValidator.java:)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:)
at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:)
at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:)
at org.springframework.beans.factory.xml.DefaultDocumentLoader.loadDocument(DefaultDocumentLoader.java:)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadDocument(XmlBeanDefinitionReader.java:)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:)
at org.springframework.beans.factory.xml.XmlBeanFactory.<init>(XmlBeanFactory.java:)
at org.springframework.beans.factory.xml.XmlBeanFactory.<init>(XmlBeanFactory.java:)
at com.example.test_nacos.DetectorL.detectDobboXml(DetectorL.java:)
at com.example.test_nacos.DetectorL.main(DetectorL.java:)
Caused by: java.net.ConnectException: Connection timed out: connect
at java.net.DualStackPlainSocketImpl.connect0(Native Method)
at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:)
at java.net.Socket.connect(Socket.java:)
at java.net.Socket.connect(Socket.java:)
at sun.net.NetworkClient.doConnect(NetworkClient.java:)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:)
at sun.net.www.http.HttpClient.<init>(HttpClient.java:)
at sun.net.www.http.HttpClient.New(HttpClient.java:)
at sun.net.www.http.HttpClient.New(HttpClient.java:)
at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:)
at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:)
at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.setupCurrentEntity(XMLEntityManager.java:)
at com.sun.org.apache.xerces.internal.impl.XMLVersionDetector.determineDocVersion(XMLVersionDetector.java:)
at com.sun.org.apache.xerces.internal.impl.xs.opti.SchemaParsingConfig.parse(SchemaParsingConfig.java:)
at com.sun.org.apache.xerces.internal.impl.xs.opti.SchemaParsingConfig.parse(SchemaParsingConfig.java:)
at com.sun.org.apache.xerces.internal.impl.xs.opti.SchemaDOMParser.parse(SchemaDOMParser.java:)
at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.getSchemaDocument(XSDHandler.java:)
... common frames omitted
Exception in thread "main" org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line in XML document from file [E:\dev\erdp2\erdp_discuss\erdp_discuss_app\src\main\resources\dubbo.xml] is invalid; nested exception is org.xml.sax.SAXParseException; lineNumber: ; columnNumber: ; cvc-complex-type.2.4.c: 通配符的匹配很全面, 但无法找到元素 'dubbo:application' 的声明。
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:)
at org.springframework.beans.factory.xml.XmlBeanFactory.<init>(XmlBeanFactory.java:)
at org.springframework.beans.factory.xml.XmlBeanFactory.<init>(XmlBeanFactory.java:)
at com.example.test_nacos.DetectorL.detectDobboXml(DetectorL.java:)
at com.example.test_nacos.DetectorL.main(DetectorL.java:)
Caused by: org.xml.sax.SAXParseException; lineNumber: ; columnNumber: ; cvc-complex-type.2.4.c: 通配符的匹配很全面, 但无法找到元素 'dubbo:application' 的声明。
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:)
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:)
at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator$XSIErrorReporter.reportError(XMLSchemaValidator.java:)
at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.reportSchemaError(XMLSchemaValidator.java:)
at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.handleStartElement(XMLSchemaValidator.java:)
at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.emptyElement(XMLSchemaValidator.java:)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:)
at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:)
at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:)
at org.springframework.beans.factory.xml.DefaultDocumentLoader.loadDocument(DefaultDocumentLoader.java:)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadDocument(XmlBeanDefinitionReader.java:)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:)
... more
启动过程中,感觉会去下载,但是下载了好一会却下载不成功。。
其实 Spring提供了一种机制,默认从本地加载XSD文件 。仔细检查,好像命名空间有问题, 是dubbo从2.6.5升级到 2.7.1 引起的吗? code.alibabatech.com 改成 dubbo.apache.org ,还是不行:
Unable to locate Spring NamespaceHandler for XML schema namespace [http://dubbo.apache.org/schema/dubbo]
Exception in thread "main" org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Unable to locate Spring NamespaceHandler for XML schema namespace [http://dubbo.apache.org/schema/dubbo]
Offending resource: file [E:\dev\erdp2\erdp_system\erdp_system_app\src\main\resources\dubbo.xml] at org.springframework.beans.factory.parsing.FailFastProblemReporter.error(FailFastProblemReporter.java:)
at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:)
at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:)
at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.error(BeanDefinitionParserDelegate.java:)
at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:)
at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:)
at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:)
at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.doRegisterBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:)
at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:)
at org.springframework.beans.factory.xml.XmlBeanFactory.<init>(XmlBeanFactory.java:)
at org.springframework.beans.factory.xml.XmlBeanFactory.<init>(XmlBeanFactory.java:)
at com.example.test_nacos.DetectorL.getDobboXml(DetectorL.java:)
at com.example.test_nacos.DetectorL.compareDubboXml(DetectorL.java:)
at com.example.test_nacos.DetectorL.main(DetectorL.java:)
想起来了之前读spring源码的时候, 对应于每一个xml 的命名空间,spring 都需要一个NamespaceHandler,比如Context需要 ContextNamespaceHandler 。
难道要修改jar 的spring.handlers/spring.schemas 文件? 检查 spring-context-5.1.5.RELEASE\META-INF\spring.handlers ,发现基本正常
http\://www.springframework.org/schema/context=org.springframework.context.config.ContextNamespaceHandler
http\://www.springframework.org/schema/jee=org.springframework.ejb.config.JeeNamespaceHandler
http\://www.springframework.org/schema/lang=org.springframework.scripting.config.LangNamespaceHandler
http\://www.springframework.org/schema/task=org.springframework.scheduling.config.TaskNamespaceHandler
http\://www.springframework.org/schema/cache=org.springframework.cache.config.CacheNamespaceHandler
突然想到,dubbo-jar 都没有引入呢!
<dependency>
<groupId>org.apache.dubbo</groupId>
<artifactId>dubbo</artifactId>
<version>2.7.</version>
</dependency>
加入就好了!
------------------------------------------------------------------------------------------------------------------------------------------------
总结一下
这样的问题,通常是由于升级引起的,特别是有些jar升级后不兼容之前的版本就会出现。
但Spring很贴心,把旧版本的XSD文件也全放了。这样可以防止升级了Spring版本,而配置文件里用的还是旧版本的XSD文件,然后断网了,应用启动不了。
我解压dubbo jar之后看到spring-context-5.1.5.RELEASE\META-INF\spring.schemas :

可见,基本上都有了。但是xsd 只有一个:

所以,如果用最新的jar ,然后xml配置老的 命名空间,那么还是会去下载xsd。下载
参考
https://dslztx.github.io/blog/2019/02/20/Unable-to-locate-Spring-NamespaceHandler-for-XML-schema-namespace/
https://www.jianshu.com/p/b16a4384dfdb
https://blog.csdn.net/wcf2010/article/details/86229222
https://blog.csdn.net/wxydaisy/article/details/40650405
DUBBO: xml文件无法解析的更多相关文章
- JDOM方法实现对XML文件的解析
首先要下载JDOM.jar包,下载地址:http://download.csdn.net/detail/ww6055/8880371 下载到JDOM.jar包之后导入到工程中去. 实例程序: book ...
- xml文件的解析
1. xml文件的解析 void CDataMgr::readStringData() { std::string xml_name = "config/string.xml"; ...
- [置顶] Android开发之XML文件的解析
Android系统开发之XML文件的解析 我们知道Http在网络传输中的数据组织方式有三种分别为:XML方式.HTML方式.JSON方式.其中XML为可扩展标记语言,如下: <?xml vers ...
- 类的反射及xml文件的解析
类的反射 xml文件的解析 .properties||.xml配置文件的创建及读取内容 //创建对象 Properties properties = new Properties(); //存储 pr ...
- JAVA读取XML文件并解析获取元素、属性值、子元素信息
JAVA读取XML文件并解析获取元素.属性值.子元素信息 关键字 XML读取 InputStream DocumentBuilderFactory Element Node 前言 最 ...
- 用SAX和PULL进行XML文件的解析与生成
XML解析有传统的dom方法还有Jsoup,SAX,PULL等,这里讲的是比较省内存的SAX和PULL方法.Android中极力推荐用PULL的方式来解析,我个人觉得pull确实比较简单,但其内部的逻 ...
- 【文件处理】xml 文件 DOM解析
一.Java解析xml.解析xml四种方法.DOM.SAX.JDOM.DOM4j.XPath 此文针对其中的DOM方法具体展开介绍及代码分析 sax.dom是两种对xml文档进行解析的方法(没有具体实 ...
- Java中使用DOM4J来生成xml文件和解析xml文件
一.前言 现在有不少需求,是需要我们解析xml文件中的数据,然后导入到数据库中,当然解析xml文件也有好多种方法,小编觉得还是DOM4J用的最多最广泛也最好理解的吧.小编也是最近需求里遇到了,就来整理 ...
- 用java操作XML文件(DOM解析方式)
XML 可扩展标记语言(Extensible Markup Language),是独立于软件和硬件的传输工具. XML的作用: (1)用作配置文件 (2)简化数据共享 (3)简化数据传输 XML DO ...
随机推荐
- python_编程面试题
使用递归方法对一个数组求最大值和最小值 """ 用递归算法求解一个数组的最大值和最小值 思路: 1.首先假设这个列表只有1个元素或两个元素 2.再考虑超过两个元素的情况, ...
- Flask开发成语接龙游戏,闲来无事手机玩玩自己写的游戏吧!
英语单词学习应用 周五发布的文章Flask开发天气查询软件,带你掌握pipenv的使用与手机Termux下的部署发布后,看到喜欢的人比较多.本来周末打算照着扇贝/极光单词,写一个英语单词自测工具.但苦 ...
- 【直播分享】实现LOL小地图英雄头像分析案例【华为云分享】
直播介绍: 当今时代是人工智能高速发展的时代,深度学习已经渗透入经济.工业.军事.娱乐等各各领域的角落.近年来AlphaGo击败李世石更是使得人工智能技术家喻户晓.人工智能在游戏领域的开发依然不断进步 ...
- virtualenv 在windows下的简单应用
https://docs.python.org/zh-cn/3/tutorial/venv.html cmd下的操作: pip install virtualenv pip install virt ...
- js 防抖、截流
突发奇想,在触发事件的时候,一些会频繁触发的事件会不会造成资源的浪费或者大量的计算造成页面卡顿,比如onresize,onscroll,onmousemove等事件. 然后就引出了一个新知识点:防抖. ...
- jQuery操作页面的元素
主要有添加,替换,删除,清空三种方式: 添加又分为,在之前添加,在之后添加,在元素外之前添加,在元素外之后添加.每个添加方式又有俩种方法(效果一模一样): 俩种方法区添加,在原内容之后: p.appe ...
- B.Box
题目:盒子 题目:排列p是一个整数序列 p = [p1, p2,...,pn],由n个唯一的正整数组成 唯一的线索是你需要打开上锁的盒子 你只知道前缀的最大数,q1, q2, ..., qn,保证qi ...
- 【Python必学】Python爬虫反爬策略你肯定不会吧?
前言 本文的文字及图片来源于网络,仅供学习.交流使用,不具有任何商业用途,版权归原作者所有,如有问题请及时联系我们以作处理. 正文 Python爬虫反爬策略三部曲,拥有这三步曲就可以在爬虫界立足了: ...
- flex布局中flex-grow与flex-shrink的计算方式
CSS 中的 Flex(弹性布局) 可以很灵活的控制网页的布局,其中决定 Flex 布局内项目宽度/高度的是三个属性: flex-basis, flex-grow, flex-shrink. flex ...
- Python3 并发编程1
目录 操作系统发展 穿孔卡片 批处理 多道技术(单核) 并发与并行 进程 程序与进程 进程调度 进程的三个状态 同步和异步 阻塞与非阻塞 僵尸进程与孤儿进程 守护进程 Python中的进程操作 Pro ...