Resolve org.testng.TestNGException: TestNG by default disables loading DTD from unsecured Urls issue while using Intellij IDEA

Asanka Vithanage
2 min readSep 18, 2020

I was trying to run a simple TestNG test from the IntelliJ Idea as in the below screenshot.

But ended up with the below exception.

org.testng.TestNGException: TestNG by default disables loading DTD from unsecured 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:115) at org.apache.xerces.util.EntityResolverWrapper.resolveEntity(Unknown Source) at org.apache.xerces.impl.XMLEntityManager.resolveEntity(Unknown Source)

The issue was only observed when running on the IDE and test executed with maven without any issue.

My project had the following configurations while running on IntelliJ IDEA 2020.2(Community Edition)

TestNG dependency:

<!-- https://mvnrepository.com/artifact/org.testng/testng -->
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>7.3.0</version>
<scope>test</scope>
</dependency>

TestNG Suite XML file

<!DOCTYPE suite SYSTEM…

--

--

Asanka Vithanage

Software Quality Assurance Professional, Problem Solver, SOA Tester, Automation Engineer, CI/CD Practitioner, DevOps enthusiast