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

12,053

Solution 1

I wasn't able to figure out a way to get mturks 1.2.2 working. However, using a different version (1.6.2) solved the problem.

My updated pom now looks like this:

<repository>
    <id>clojars.org</id>
    <url>http://clojars.org/repo</url>
</repository>
...
<dependency>
    <groupId>org.clojars.zaxtax</groupId>
    <artifactId>java-aws-mturk</artifactId>
    <version>1.6.2</version>
    <exclusions>
        <exclusion>
            <groupId>commons-lang</groupId>
            <artifactId>commons-lang</artifactId>
        </exclusion>
    </exclusions>
</dependency>

Solution 2

This isn't specific to mturks, but here's a general approach for finding the xerces conflicts in eclipse to resolve the issue.

  1. Open your pom.xml in the eclipse editor and switch to the "Dependency Hierarchy" tab

  2. In the "Filter" box in the top right, type "xerces"

  3. The dependencies pulling in xercesImpl will be shown in the "Dependency Hierarchy" pane to the left

  4. Right click the offending xercesImpl entry and select "Exclude Maven Artifact...". This will update your pom with an exclusion which will resolve the conflict

  5. Be sure to press ctrl-s to save your pom changes

Dependency Hierarchy panel

Here's an example of the before and after in the raw pom.xml (eclipse did this for you in the above steps:

BEFORE

    <dependency>
      <groupId>junit-addons</groupId>
      <artifactId>junit-addons</artifactId>
      <version>1.4</version>
      <scope>test</scope>
    </dependency>

AFTER

    <dependency>
      <groupId>junit-addons</groupId>
      <artifactId>junit-addons</artifactId>
      <version>1.4</version>
      <scope>test</scope>
      <exclusions>
        <exclusion>
            <artifactId>xercesImpl</artifactId>
            <groupId>xerces</groupId>
        </exclusion>
      </exclusions>
    </dependency>

With this simple change, you can avoid the "access is not allowed due to restriction set..." error without resorting to JRE modifications or global settings

Share:
12,053
cscan
Author by

cscan

Updated on June 28, 2022

Comments

  • cscan
    cscan over 1 year

    I am receiving this error while unmarshalling a class. I'm using Amazon's mTurks along with Spring, Maven and (surprise, surprise) a xerces issue has reared it's head.

    I've played with the POM in many different ways to try and iron out the problem but I can't seem to figure out the solution.

    I'm using a mavenized version of mturks found here: https://github.com/tc/java-aws-mturk

    I've explicitly excluded the xerces stuff from mturks:

    <dependency>
        <groupId>com.amazon</groupId>
        <artifactId>java-aws-mturk</artifactId>
        <version>1.2.2</version>
        <exclusions>
            <exclusion>
                <groupId>commons-lang</groupId>
                <artifactId>commons-lang</artifactId>
            </exclusion>
            <exclusion>
                <groupId>apache-xerces</groupId>
                <artifactId>xercesImpl</artifactId>
            </exclusion>
            <exclusion>
                <groupId>apache-xerces</groupId>
                <artifactId>resolver</artifactId>
            </exclusion>
            <exclusion>
                <groupId>apache-xerces</groupId>
                <artifactId>xml-apis</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
    

    And explicitly included both xerces-impl and xml-api dependencies:

    <dependency>
        <groupId>xerces</groupId>
        <artifactId>xercesImpl</artifactId>
        <version>2.11.0</version>
    </dependency>
    <dependency>
        <groupId>xml-apis</groupId>
        <artifactId>xml-apis</artifactId>
        <version>1.4.01</version>
    </dependency>
    

    I've tried all four combinations with xercesImpl versions 2.9.1, 2.11.0 and xml-apis versions 1.4.01, 2.0.2 to no avail.

    xercesImpl 2.11.0 and xml-api 2.0.2 leads to a different error:

    java.lang.NoClassDefFoundError: org/w3c/dom/ElementTraversal
    

    How can I resolve this issue?