Xerces 错误:org.apache.xerces.impl.dv.dtd.DTDDVFactoryImpl
我正在使用 JSF 2.0、NetBeans 6.9.1、GlassFish Server 3.1、mojarra 2.0.3 和 JasperReports 3.7.6 开发 Web 应用程序。我的项目库中包含 jar 文件“xerces-2.8.0.jar”。该文件作为 JasperReports jar 文件库的一部分导入。每当我尝试通过 NetBeans 部署、运行或调试我的项目时,我都会收到此错误:
java.lang.Exception: java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: com.sun.faces.config.ConfigurationException: CONFIGURATION FAILED! DTD factory class org.apache.xerces.impl.dv.dtd.DTDDVFactoryImpl does not extend from DTDDVFactory.
在项目中进行任何更改后,我的构建失败,并且当我尝试部署、运行或调试它时,我收到上述错误。我必须重新启动服务器并再次运行/调试。我在互联网上搜索过,但找不到解决这个问题的方法。我查看了相关的 jar 文件,并且 DTDDVFactoryImpl 确实是从 DTDDVFactory 扩展的 - 我不知道为什么会收到此错误。虽然我最终可以让我的项目运行,但如果我没有收到此错误,那就更好了。
谁能告诉我如何解决这个问题?我需要从我的项目库中删除该文件吗?我需要用新版本/旧版本更新此文件吗?
I'm developing a web application using JSF 2.0, NetBeans 6.9.1, GlassFish Server 3.1, mojarra 2.0.3, and JasperReports 3.7.6. Included in my project library is the jar file "xerces-2.8.0.jar". This file was imported as part of the JasperReports jar file library. Whenever I try to deploy, run, or debug my project through NetBeans, I receive this error:
java.lang.Exception: java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: com.sun.faces.config.ConfigurationException: CONFIGURATION FAILED! DTD factory class org.apache.xerces.impl.dv.dtd.DTDDVFactoryImpl does not extend from DTDDVFactory.
After any change in my project my build fails, and I receive the above error, when I try to deploy, run, or debug it. I have to restart the server and run/debug a second time. I've searched the internet and cannot find a solution to this problem. I've looked at the jar file in question, and and DTDDVFactoryImpl does indeed extend from DTDDVFactory - I don't know why I'm receiving this error. While I can eventually get my project running, it would be much nicer if I wasn't receiving this error.
Can anyone please tell me how I can fix this? Do I need to remove this file from my project library? Do I need to update this file with a newer version/older version?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您提供自己的 xerces.jar,则必须通过认可标准覆盖机制 (
java -Djava.endorsed.dirs=/path/to/xerces.jar
) 来执行此操作,您不被允许只需将其添加到类路径中(如果这样做迟早会遇到麻烦)。让我解释一下。JAXP 是用于 XML 处理的 Java API。 JAXP 对象(如解析器、XSLT 转换器、DOM 文档)的创建是通过 factory/factory-method 模式完成的 这样您就可以插入一个新的 JAXP 实现(它必须比 JRE 中提供的实现更新)。 Xerces 提供(部分)JAXP 实现并包含认可的标准(认可的标准是通过 Java 社区流程以外的标准流程定义的 Java API,请参阅 认可的标准覆盖机制)。如果您不使用 ESOM,您将会遇到各种麻烦。
If you provide your own xerces.jar, you have to do that through the Endorsed Standards Override Mechanism (
java -Djava.endorsed.dirs=/path/to/xerces.jar
), you are not allowed to just add it on the classpath (and will sooner or later run into trouble if you do). Let me explain.JAXP is the Java API for XML Processing. The creation of JAXP objects (like parsers, XSLT transfomers, DOM Documents) is done through the factory/factory-method pattern so you can plugin a new JAXP implementation (it has to be newer than the one provided in your JRE). Xerces provides (part of) a JAXP implementation and contains endorsed standards (an endorsed standard is a Java API defined through a standards process other than the Java Community Process, see the Endorsed Standards Override Mechanism). You'll run in all kinds of troubles if you don't use the ESOM.
我在将 Selenium 与 Glassfish 一起使用时遇到此错误。我通过将 XML jar(
xerces-*、xalan-*、xml-apis*、serialize*
)从selenium/libs/
复制到$AS_HOME 来解决这个问题/lib/endorsed
(对于 Glassfish 2)或$AS_HOME/glassfish/lib/endorsed
对于 Glassfish 4。I got this error when using Selenium with Glassfish. I got around it by copying XML jars (
xerces-*, xalan-*, xml-apis*, serialize*
) fromselenium/libs/
to$AS_HOME/lib/endorsed
(for Glassfish 2) or to$AS_HOME/glassfish/lib/endorsed
for Glassfish 4.