转自:http://lengweiping1983.iteye.com/blog/248563
在用main函数读取spring配置文件的时候报错
Provider org.apache.xerces.jaxp.DocumentBuilderFactoryImpl not found
Caused by: javax.xml.parsers.FactoryConfigurationError: Provider org.apache.xerces.jaxp.DocumentBuilderFactoryImpl not found
at javax.xml.parsers.DocumentBuilderFactory.newInstance(Unknown Source)
at org.springframework.beans.factory.xml.DefaultDocumentLoader.createDocumentBuilderFactory(DefaultDocumentLoader.java:87)
解决方法 设置两个属性(javax.xml.parsers.DocumentBuilderFactory,javax.xml.parsers.SAXParserFactory)值如下:
System.setProperty("javax.xml.parsers.DocumentBuilderFactory",
"com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl");
System.setProperty("javax.xml.parsers.SAXParserFactory",
"com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl");
最后发现原因是我使用MyEclipse创建项目时引用了J2EE 1.4 Library Container库(JAVA构建路径-->库)
使得sun.boot.class.path增加了myelipse下的jar文件,然后就把javax.xml.parsers.DocumentBuilderFactory变量的值设为org.apache.xerces.jaxp.DocumentBuilderFactoryImpl
即还有第二种解决方法,就是去掉J2EE 1.4 Library Container库,编译,再运行就没有错了.
(JDK版本为1.5与6.0都测试通过).
分享到:
相关推荐
jar包,官方版本,自测可用
例如,如果你的项目使用了需要Xerces支持的库,或者你自己编写了依赖于Xerces的代码,那么你需要确保将"org.apache.xerces-2.9.0.jar"或"xerces.jar"添加到项目的类路径中。你可以通过Maven、Gradle等构建工具进行...
在这个特定的情况下,错误提示`org.apache.xerces.dom.DocumentImpl.setXmlVersion`指出问题源于Apache Xerces的DOM实现,它是一个流行的XML解析库。 `AbstractMethodError`通常意味着缺少了某个依赖或版本冲突。...
jar包,官方版本,自测可用
描述 "Provider org.apache.xerces.jaxp.DocumentBuilderFactoryImpl not found" 是一个常见的错误消息,这通常意味着在运行时环境中,系统无法找到指定的 XML 解析器提供商。JAXP(Java API for XML Processing)是...
faultCode: {... at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source ) at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanEndElement(Unknow n Source)
java.lang.AbstractMethodError: org.apache.xerces.dom.ElementNSImpl.setUserData(Ljava/lang/String;Ljava/lang/Object;Lorg/w3c/dom/UserDataHandler;)Ljava/lang/Object; at org.apache.cxf.staxutils.StaxUtil...
org.apache.xerces org.apache.xml org.apache.xmlbeans org.apache.xmlcommons org.apache.derby org.apache.poi org.apache.struts org.apache.taglibs 5号包: org.codehaus.castor org.aspectj org.beanshell 6...
org.apache.xerces org.apache.xml org.apache.xmlbeans org.apache.xmlcommons org.apache.derby org.apache.poi org.apache.struts org.apache.taglibs 5号包: org.codehaus.castor org.aspectj org.beanshell 6...
org.apache.xerces org.apache.xml org.apache.xmlbeans org.apache.xmlcommons org.apache.derby org.apache.poi org.apache.struts org.apache.taglibs 5号包: org.codehaus.castor org.aspectj org.beanshell 6...
org.apache.xerces org.apache.xml org.apache.xmlbeans org.apache.xmlcommons org.apache.derby org.apache.poi org.apache.struts org.apache.taglibs 5号包: org.codehaus.castor org.aspectj org.beanshell 6...
org.apache.xerces org.apache.xml org.apache.xmlbeans org.apache.xmlcommons org.apache.derby org.apache.poi org.apache.struts org.apache.taglibs 5号包: org.codehaus.castor org.aspectj org.beanshell 6...
org.apache.xerces org.apache.xml org.apache.xmlbeans org.apache.xmlcommons org.apache.derby org.apache.poi org.apache.struts org.apache.taglibs 5号包: org.codehaus.castor org.aspectj org.beanshell 6...
org.apache.xerces org.apache.xml org.apache.xmlbeans org.apache.xmlcommons org.apache.derby org.apache.poi org.apache.struts org.apache.taglibs 5号包: org.codehaus.castor org.aspectj org.beanshell 6...
org.apache.xerces org.apache.xml org.apache.xmlbeans org.apache.xmlcommons org.apache.derby org.apache.poi org.apache.struts org.apache.taglibs 5号包: org.codehaus.castor org.aspectj org.beanshell 6...
然而,尽管Apache Crimson曾经是一个流行的XML解析库,但它现在已经被更现代、更高效的库如Java自带的JAXB(Java Architecture for XML Binding)和Apache Xerces所取代。这些现代库提供了更好的性能和更多的XML标准...
at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:283) ... 5 more 在网上查了一天的时间终于得以解决 附件中包含测试类javaAxisCallnet.java和所需的jar包
jar包,官方版本,自测可用
- **配置解析器**:在Java代码中,可以通过`org.apache.xerces.jaxp.DocumentBuilderFactoryImpl`或`org.apache.xerces.jaxp.SAXParserFactoryImpl`来创建并配置解析器。 - **错误处理**:解析过程中如果遇到错误,...