TestNG by default disables loading DTD from unsecure Urls

While executing TestNG sometime we hit below error:

org.testng.TestNGException: 
TestNG by default disables loading DTD from unsecure Urls. If you need to explicitly load the DTD from a http url, please do so by using the JVM argument [-Dtestng.dtd.http=true]
    at org.testng.xml.TestNGContentHandler.resolveEntity(TestNGContentHandler.java:102) This can be sol;ved using 3 ways. 1. First and ideal way is to use https url in TestNGXML.It should be like:
  1. Very first and ideal way is to use https URL in TestNG.xml file. <!DOCTYPE suite SYSTEM “https://testng.org/testng-1.0.dtd”>
    instead of <!DOCTYPE suite SYSTEM “http://testng.org/testng-1.0.dtd”>
  2. Second way is to update Run Configuration and add VM argument -ea -Dtestng.dtd.http=true:
VM Argument

3. Third way is to update the eclipse TestNG Preferences

Leave a Reply

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