Search code examples
javaxmlspringmavenxerces

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


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?


Solution

  • 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>