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. 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文件。 我该如何解决这个问题?


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

链接地址: http://www.djcxy.com/p/34899.html

上一篇: Conflict between Spring and XOM

下一篇: Ignore DOCTYPE .dtd, but .dtd file must still exist