org.xml.sax.SAXNotRecognizedException:无法识别功能“http://javax.xml.XMLConstants/feature/secure-processing”

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/20473689/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-06 11:57:20  来源:igfitidea点击:

org.xml.sax.SAXNotRecognizedException: Feature 'http://javax.xml.XMLConstants/feature/secure-processing' is not recognized

xmlunixantjaxb

提问by user3083275

Hi in our project we are using XJC ant task for xsd2schema generation after that we are compiling the src files and grouping them into a schema jar. the classpath we have for that is:

嗨,在我们的项目中,我们使用 XJC ant 任务生成 xsd2schema,之后我们正在编译 src 文件并将它们分组到架构 jar 中。我们为此拥有的类路径是:

jaxb-ri-2.2.6 - jaxb-impl.jar,jaxb-api.jar,jaxb-xjc.jar

This ant task is working fine in eclipse and jar got created , but it is throwing errors in unix environment.

这个 ant 任务在 Eclipse 和 jar 中运行良好,但它在 unix 环境中抛出错误。

The Error is:

错误是:

java.lang.IllegalStateException: org.xml.sax.SAXNotRecognizedException: Feature 'http://javax.xml.XMLConstants/feature/secure-processing' is not recognized.

java.lang.IllegalStateException: org.xml.sax.SAXNotRecognizedException:无法识别功能“ http://javax.xml.XMLConstants/feature/secure-processing”。

That error gone , when we added "xercesImpl-2.9.1.jar" to unix build classpath, but the jar generated was different from the jar that generated using eclipse.

当我们将“xercesImpl-2.9.1.jar”添加到 unix 构建类路径时,该错误消失了,但生成的 jar 与使用 eclipse 生成的 jar 不同。

eclipse build jar- it has only few classes unix build jar- it has impl folder and so many classes

eclipse build jar - 它只有几个类 unix build jar - 它有 impl 文件夹和很多类

In both the cases the jaxb jars were the same. Please help me with this issue....Please...................

在这两种情况下,jaxb jar 都是相同的。请帮我解决这个问题......请......

回答by Biswas

Upgrade or add your xercesImpl jar file located in jre/lib/endorsedfolder to xercesImpl 2.9.1. You can simply download it and replace it. It must work.

将位于jre/lib/endorsed文件夹中的xercesImpl jar 文件升级或添加到 xercesImpl 2.9.1。您可以简单地下载并替换它。它必须工作。

回答by otterslide

If you have Maven, add this to pom.xml

如果您有 Maven,请将其添加到 pom.xml

<dependency>
        <groupId>xerces</groupId>
        <artifactId>xercesImpl</artifactId>
        <version>2.11.0</version>
</dependency>

回答by Naveen Kumar

You need jdk 7. JDK 8 have this issue with maven tests.

你需要 jdk 7. JDK 8 在 maven 测试中有这个问题。

回答by Sam

upgrade xercesImpl.jar to the latest version, and make sure it is loaded, it will work with JDK 8.

将 xercesImpl.jar 升级到最新版本,并确保它已加载,它将与 JDK 8 一起使用。

回答by Aditya Bhuyan

Please add xercesImpl-2.9.1.jar into [JDK Path]/jre/lib/endorsed directory. It would solve the issue for Java 1.8

请将 xercesImpl-2.9.1.jar 添加到 [JDK Path]/jre/lib/endorsed 目录中。它将解决 Java 1.8 的问题

回答by Alex

I had this problem because the workspace was using JRE instead of JDK

我遇到这个问题是因为工作区使用的是 JRE 而不是 JDK