xjc

XJC 4.0.1 Producing Error "External parsing is disabled" Despite Turning Feature On in jaxp.properties


I am getting an error using XJC 4.0.1 on Windows 10 while attempting to generate Java source from a DTD:

C:\Users\mbmas_000\workspace\EnergyMeterMonitor>"C:\Program Files\Java\jdk-17.0.3.1\bin\java" --module-path "C:\Program Files\Java\jaxb-ri\mod\jakarta.xml.bind-api.jar";"C:\Program Files\Java\jaxb-ri\mod\jaxb-xjc.jar";"C:\Program Files\Java\jaxb-ri\mod\jaxb-core.jar";"C:\Program Files\Java\jaxb-ri\mod\jaxb-impl.jar";"C:\Program Files\Java\jaxb-ri\mod\jakarta.activation-api.jar" --add-modules com.sun.xml.bind  -m com.sun.tools.xjc -dtd -d generatedsrc -p com.mbm.test http://www.egauge.net/DTD/egauge-hist.dtd
parsing a schema...
[WARNING] Are you trying to compile DTD? Support for DTD is experimental. You may enable it by using the -dtd option.
unknown location

[ERROR] External parsing is disabled. Cannot parse URI: http://www.egauge.net/DTD/egauge-hist.dtd
unknown location

Failed to parse a schema.

Here is the contents of jaxp.properties:

javax.xml.accessExternalSchema = all
javax.xml.accessExternalDTD = all

Here is proof XJC is reading jaxp.properties:

enter image description here

What am I doing wrong? I find it strange that XJC also gives me warning about trying to compile a DTD and suggesting that I specify -dtd when I have specified -dtd. Is Failed to parse a schema a clue? Shouldn't that be Failed to parse a DTD or is this just a generic error message?

UPDATE:

Even when I point XJC directly at a local .DTD file, I get the same error. Here's proof XJC found the file but never attempted to read the file:

enter image description here


Solution

  • I have faced the same issue.

    Check this page, it helps to me to fixed it

    https://github.com/IntershopCommunicationsAG/jaxb-gradle-plugin/issues/9