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 ...
随机推荐
- yarn和npm的对比以及yarn的使用
0--前言 为什么要使用yarn,如果你从事前端开发有些年头了,那你肯定对npm又爱又恨,爱就不说了,恨嘛,就是NPM经常奇慢和卡顿,这还能忍,经常各种错误就没法忍了,尤其是他人创建的项目,自己在安装 ...
- IIS+PHP上传文件大小限制和上传时间限制,iis7和iis8上传文件大小限制和上传时间限制
先说IIS这边的配置 一:点击站点“管理”下的“配置编辑器”. 二:设 ...
- 第三章 学习Shader所需的数学基础(2)
目录 1.坐标空间 1.2 坐标空间的变换 @ 1.坐标空间 我们在以前渲染流水线中就接触了坐标空间的变换.例如,在学习顶点着色器流水线阶段时,我们说过,顶点着色器的最基本功能就是把模型的顶点坐标从模 ...
- Python如何爬取实时变化的WebSocket数据【华为云技术分享】
一.前言 作为一名爬虫工程师,在工作中常常会遇到爬取实时数据的需求,比如体育赛事实时数据.股市实时数据或币圈实时变化的数据.如下图: Web 领域中,用于实现数据'实时'更新的手段有轮询和 WebSo ...
- 【nodejs原理&源码赏析(7)】【译】Node.js中的事件循环,定时器和process.nextTick
目录 Event Loop 是什么? Event Loop 基本解释 事件循环阶段概览 事件循环细节 timers pending callbacks poll阶段 check close callb ...
- eNSP 简介及基础操作
eNSP 一. eNSP简介 eNSP是一款由华为自主研发的.免费的.可扩展的.图形化操作的网络仿真工具平台,主要对企业网络路由器.交换机及相关物理设备进行软件仿真,支持大型网络模拟.界面如下: 界面 ...
- 一道时间复杂度为O(N)空间复杂度为O(1)的排序问题
题目:对1, 2, ... , n的一个无序数组,排序,要求时间复杂度为O(N),空间复杂度为O(1). 思路:该题利用数组元素和数组下标相差1的关系,Java代码如下: import java.ut ...
- Python3 常用的几个内置方法
目录 max()/min() filter() 过滤 map() 映射 sorted筛选 reduce()减少 max()/min() 传入一个参数 (可迭代对象), 返回这个可迭代对象中最大的元素 ...
- RNN循环神经网络
1.为什么还会有RNN? CNN(卷积神经网络)我们会发现, 他们的输出都是只考虑前一个输入的影响而不考虑其它时刻输入的影响, 比如简单的猫,狗,手写数字等单个物体的识别具有较好的效果. 但是, 对于 ...
- 【Eureka】服务发现调用
[Eureka]服务发现调用 转载:https://www.cnblogs.com/yangchongxing/p/10779832.html 1.使用 Netfix Feign 客户端调用服务 首先 ...