错误1:nested exception is javax.xml.parsers.FactoryConfigurationError:
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)
解决方法:
设置两个属性 (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构建路径-->库)
错误2:java.lang.reflect.InvocationTargetException
原因:jdk版本问题,配置出错,还有可能是缺少jar文件的原因。我出现过那次问题是因为配置出错了。