本文主要是介绍转:Provider org.apache.xerces.jaxp.DocumentBuilderFactoryImpl not found,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
转自:[url=http://lengweiping1983.iteye.com/blog/248563]http://lengweiping1983.iteye.com/blog/248563[/url]在用main函数读取spring配置文件的时候报错
provider org.apache.xerces.jaxp.documentbuilderfactoryimpl not found <br>caused by: javax.xml.parsers.factoryconfigurationerror: provider org.apache.xerces.jaxp.documentbuilderfactoryimpl not found <br>at javax.xml.parsers.documentbuilderfactory.newinstance(unknown source) <br>at org.springframework.beans.factory.xml.defaultdocumentloader.createdocumentbuilderfactory(defaultdocumentloader.java:87)
<span style="color: #000000;"><span style="color: blue;"><span style="color: #000000;">解决方法 设置两个属性(javax.xml.parsers.documentbuilderfactory,javax.xml.parsers.saxparserfactory)值如下:</span></span> <br></span>
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构建路径-->库) <br>使得sun.boot.class.path增加了myelipse下的jar文件,然后就把javax.xml.parsers.documentbuilderfactory变量的值设为org.apache.xerces.jaxp.documentbuilderfactoryimpl <br>即还有第二种解决方法,就是去掉j2ee 1.4 library container库,编译,再运行就没有错了. <br><br>(jdk版本为1.5与6.0都测试通过). <br>
这篇关于转:Provider org.apache.xerces.jaxp.DocumentBuilderFactoryImpl not found的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!