Martin Wunderlich
Martin Wunderlich

Reputation: 1884

Java 17 migration, JEP-403 and Xerces - properties ACCESS_EXTERNAL_DTD and ACCESS_EXTERNAL_SCHEMA not supported

Whilst migrating to Java 17, I tried to include an external Xerces dependency, following the JEP-403 recommendation. JEP-403 explicitly states the following under "Risks and Assumptions":

"Code that uses the JDK’s internal copy of the Xerces XML processor. Such code should instead use a standalone copy of the Xerces library, available from Maven Central." (otherwise, such code might fail) https://openjdk.org/jeps/403

However, after including Xerces2 version 2.12.2, two of the properties used by our SAXParser are not supported anymore, namely ACCESS_EXTERNAL_DTD and ACCESS_EXTERNAL_SCHEMA.

This is a known issue and most solutions I found suggest to either exclude the external Xerces (when it's brought in as a transitive dependency) or to use the on-board JDK version.

Is there a better solution that is in line with the JEP-403 recommendation?

Upvotes: 1

Views: 1228

Answers (1)

Martin Wunderlich
Martin Wunderlich

Reputation: 1884

So, as it turns out, the JEP section is phrased somewhat misleadingly. What they presumably meant to say is that you shouldn't code directly against the Xerces APIs because then things might break. However, using the JAX-B API is fine.

Upvotes: 1

Related Questions