External DTD: Failed to read external DTD ‘.dtd’, because ‘file’ access is not allowed due to restriction set by the accessExternalDTD property

[org.xml.sax.SAXParseException; lineNumber: 2; columnNumber: 36; External DTD: Failed to read external DTD ‘Custom.dtd’, because ‘file’ access is not allowed due to restriction set by the accessExternalDTD property.]

Stacktrace

</p>
<p>Exception in thread &quot;main&quot; javax.xml.bind.UnmarshalException<br />
- with linked exception:<br />
[org.xml.sax.SAXParseException; lineNumber: 2; columnNumber: 36; External DTD: Failed to read external DTD 'Custom.dtd', because 'file' access is not allowed due to restriction set by the accessExternalDTD property.]<br />
at javax.xml.bind.helpers.AbstractUnmarshallerImpl.createUnmarshalException(AbstractUnmarshallerImpl.java:335)<br />
at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.createUnmarshalException(UnmarshallerImpl.java:563)<br />
at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:249)<br />
at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:214)</p>
<p>

Solution

Add the following property to your vm arguments.

</p>
<p>-Djavax.xml.accessExternalDTD=all</p>
<p>

Like this post? Don’t forget to share it!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.