Spring和XOM之间的冲突



在我的Java程序中,我创建了一个使用XOM读取XML文件的类。我也在使用Spring。当线路:执行ApplicationContext ctx = new ClassPathXmlApplicationContext("dataIO-beans.xml");时,我得到一个异常,其中包括:javax.xml.parsers.ParserConfigurationException: Unable to validate using XSD: Your JAXP provider [org.apache.xerces.jaxp.DocumentBuilderFactoryImpl@4d48f152] does not support XML Schema. Are you running on Java 1.4 with Apache Crimson? Upgrade to Apache Xerces (or Java 1.5) for full XSD support.如果我从Eclipse项目构建路径中删除dtd-xercesImpl.jar,Spring就会成功地从xml文件中读取bean,但现在我的xml读取类不起作用,因为XOM需要那个jar文件。我该如何更正?

看起来我找到了一个解决方案。我从下载了Xerces2二进制文件http://xerces.apache.org/mirrors.cgi并将这些jar添加到构建路径中,而不是使用dtd-xercesImpl.jar,这就成功了。

最新更新