hoho,把你的xerces的包从加载路进上去掉,看看是否会出错,如果出错,证明用的就是!!!
解决方案 »
- struts-validation验证框架总提示Resource application.properties Not Found.
- 用ssh框架怎样连接两个数据库
- jfreechart与表格同步刷新问题
- struts2 中的form提交问题
- 我用jotm + tomcat5.5 + jdk5 + sqlserver +msjtds做jta总是运行一段时间就报告这个错误!
- 请教hibernate如何在**.hbm.xml中配置自增长主键?
- 关于jsp文件上传问题问题
- JbuilderX+Weblogic 8.1 开发Entity EJB的奇怪问题?
- 各位兄弟:applet无法显示中文,怎么处理?
- hibernate many to one 保存出错
- Apache2.0.52 安装的错误,大家帮助阿?谢谢了,再线等
- beanreader的用户如何将一个xml内容生成对象
public static SAXParserFactory newInstance()
throws FactoryConfigurationError
{
try {
return (SAXParserFactory) FactoryFinder.find(
/* The default property name according to the JAXP spec */
"javax.xml.parsers.SAXParserFactory",
/* The fallback implementation class name */
"org.apache.crimson.jaxp.SAXParserFactoryImpl");
} catch (FactoryFinder.ConfigurationError e) {
throw new FactoryConfigurationError(e.getException(),
e.getMessage());
}
}
可我想找个不用修改源代码的方法:
刚才发现jdk文档中是这样描述是按什么顺序来决定使用哪个类的:
(1)Use the javax.xml.parsers.DocumentBuilderFactory system property.
(2)Use the properties file "lib/jaxp.properties" in the JRE directory. This configuration file is in standard java.util.Properties format and contains the fully qualified name of the implementation class with the key being the system property defined above.
(3)Use the Services API (as detailed in the JAR specification), if available, to determine the classname. The Services API will look for a classname in the file META-INF/services/javax.xml.parsers.DocumentBuilderFactory in jars available to the runtime.
(4)Platform default DocumentBuilderFactory instance.照此看来,我用的应该是方法2,我看不懂的是最优先使用的也就是第一个中所说的 the javax.xml.parsers.DocumentBuilderFactory system property 是什么东西?
这个文件中的内容是不是就我上面写的那两句? 位置再JAVA_HOME\jre\lib下,没错吧?
znjq1001(追风)给的正解
或者你在程序里面一开始就调用
System.setProperty(“org.xml.sax.driver”,“org.apache.xerces.parsers.SAXParser”)还可以在Eclipse里指定VM argument:
org.xml.sax.driver=org.apache.xerces.parsers.SAXParser
追风的方法是优先级最高的,添加jaxp.properties的方式排在第二,只是在我这儿这种方法总是不起作用,我把jaxp。properties输入些乱七八糟的东西,也不报错, 谁能估计是那些原因吗?
我在其余的地方找了好久,也没找到答案
或者你在程序里面 System.setProperty("javax.xml.parsers.DocumentBuilderFactory", "org.apache.xerces.jaxp.DocumentBuilderFactoryImpl"); 试拭
是不是在什么地方设置了System Proper
你在DocumentBuilderFactory.newInstance()前,取系统属性System.getProperty("javax.xml.parsers.DocumentBuilderFactory") 看看有没有值?要下班了。:)