xml解析失败的示例分析

今天就跟大家聊聊有关xml解析失败的示例分析,可能很多人都不太了解,为了让大家更加了解,小编给大家总结了以下内容,希望大家根据这篇文章可以有所收获。

创新互联专注于企业全网营销推广、网站重做改版、天峻网站定制设计、自适应品牌网站建设、H5开发商城开发、集团公司官网建设、成都外贸网站建设、高端网站制作、响应式网页设计等建站业务,价格优惠性价比高,为天峻等各大城市提供网站开发制作服务。

本来准备用dubbo写个测试程序,在eclipse运行OK,发到测试环境准备开始验证, 结果出现以下异常:  Exception in thread "main" org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 13 in XML document from URL \[jar:file:/C:/Users/XXX/Downloads/single-data/single-data/target/single-data-1.0.1.jar!/consumer.xml\] is invalid; nested exception is org.xml.sax.SAXParseException; lineNumber: 13; columnNumber: 59; cvc-complex-type.2.4.c: 通配符的匹配很全面, 但无法找到元素 'dubbo:application' 的声明。         at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:399)         at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:336)         at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:304)         at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:181)         at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:217)         at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:188)         at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:252)         at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:127)         at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:93)         at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:129)         at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:614)         at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:514)         at org.springframework.context.support.ClassPathXmlApplicationContext.(ClassPathXmlApplicationContext.java:139)         at org.springframework.context.support.ClassPathXmlApplicationContext.(ClassPathXmlApplicationContext.java:83)         at com.open.loading.TestLoading.main(TestLoading.java:20) Caused by: org.xml.sax.SAXParseException; lineNumber: 13; columnNumber: 59; cvc-complex-type.2.4.c: 通配符的匹配很全面, 但无法找到元素 'dubbo:application' 的声明。         at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)         at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(Unknown Source)         at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown Source)         at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown Source)         at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown Source)         at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator$XSIErrorReporter.reportError(Unknown Source)         at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.reportSchemaError(Unknown Source)         at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.handleStartElement(Unknown Source)         at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.emptyElement(Unknown Source)         at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)         at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(Unknown Source)         at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(Unknown Source)         at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(Unknown Source)         at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)         at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)         at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)         at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)         at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(Unknown Source)         at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(Unknown Source)         at org.springframework.beans.factory.xml.DefaultDocumentLoader.loadDocument(DefaultDocumentLoader.java:76)         at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadDocument(XmlBeanDefinitionReader.java:429)         at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:391)

看到dubbo的namespace,  想起spring自定义schema的处理方式, 于是查看打完的jar包里面的META-INF/spring-hanlder,  发现果然没有dubbo相关的配置。问题明朗,于是改了下maven打包配置

加了2个 transformer, 问题解决。

记录这个事情的原因是这个是第二次遇到了, 每次都花了我接近一个小时查问题,在压力大的情况下很难

看完上述内容,你们对xml解析失败的示例分析有进一步的了解吗?如果还想了解更多知识或者相关内容,请关注创新互联行业资讯频道,感谢大家的支持。


当前名称:xml解析失败的示例分析
转载来于:http://ybzwz.com/article/iisgss.html