In the file: DNSJavaNameServiceDescriptor
There is a static block which attempts to get the ClassLoader using NameService.class.getClassLoader().
If NameService is loaded by the BootLoader (in my case), null is returned, causing the Proxy.newProxyInstance call to fail on the following line.
Suggestion to change code from:
ClassLoader loader = NameService.class.getClassLoader();
nameService = (NameService) Proxy.newProxyInstance(loader,
new Class[] { NameService.class },
new DNSJavaNameService());
To:
ClassLoader loader = NameService.class.getClassLoader();
if (loader == null) {
loader = ClassLoader.getSystemClassLoader();
}
nameService = (NameService) Proxy.newProxyInstance(loader,
new Class[] { NameService.class },
new DNSJavaNameService());
https://github.com/dnsjava/dnsjava/issues/26