The current implementation of JAXPPolicyManager.java depends on the fact that the test machinery will load the testng data provider before the testng listener that sets the security manager is invoked.
This is a bit fragile, as recent version of testng (9.6.10 - maybe earlier) have invalidated this assumption (see [1]).
One solution to the problem would be to change JAXPPolicyManager.java to grant all permissions to the test machinery.
[1]
http://mail.openjdk.java.net/pipermail/core-libs-dev/2016-November/044917.html
This is a bit fragile, as recent version of testng (9.6.10 - maybe earlier) have invalidated this assumption (see [1]).
One solution to the problem would be to change JAXPPolicyManager.java to grant all permissions to the test machinery.
[1]
http://mail.openjdk.java.net/pipermail/core-libs-dev/2016-November/044917.html