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


Exception in thread "main" javax.xml.bind.UnmarshalException
- with linked exception:
[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.]
at javax.xml.bind.helpers.AbstractUnmarshallerImpl.createUnmarshalException(AbstractUnmarshallerImpl.java:335)
at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.createUnmarshalException(UnmarshallerImpl.java:563)
at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:249)
at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:214)

Solution

Add the following property to your vm arguments.


-Djavax.xml.accessExternalDTD=all

Leave a Comment

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