DNS resolution using latest docker nightly image of Tigase XMPP Server 8.3.0-SNAPSHOT fails to resolve DNS SRV records.
Andrzej Wójcik (Tigase) commented 3 years ago
This results in the following error being reported in the logs (after manually enabling them due to FINER logging level):
[2022-03-21 16:06:17:410] [FINER ] [ pool-17-thread-1 ] DNSResolverIfc.getHostSRV_Entries(): Problem getting SRV DNS records for domain: tigase.org, Cannot instantiate class: com.sun.jndi.dns.DnsContextFactory
After investigation, I've discovered that this only happens on the nightly docker image. No issues when running DNS resolver in IDE or from command line.
Finally, I've checked Dockerfile for generating nightly builds and it looks like it was the cause of the issue as now it uses jlink and has a list of modules which are provided (not all provided by Java). This list was missing jdk.naming.dns which is required to use com.sun.jndi.dns.DnsContextFactory for DNS resolution of SRV records.
Andrzej Wójcik (Tigase) commented 3 years ago
After adding proper parameter to jlink in a Dockerfile, the new image started to properly resolve DNS SRV entries.
I think that this exception should have higher logging level, maybe WARNING? as it has a large impact on installation and may be caused by minor misconfiguration of Java runtime and with FINER level, it is not visible at all.
wojciech.kapcia@tigase.net commented 3 years ago
Thank you for catching it. Indeed jlink was the culprit though it's somewhat understandable given it's intention (though I checked generated images… but we are still in nightly phase).
Regarding the exception I'm in favour of changing the logging level because it's essential though with a caveat - WARNING would work well for problems caused by our code/JVM/configuration (i.e. "Cannot instantiate class") but that entry was logged in NamingException catch block so in that case I would be against having WARNING here as it would simply flood logs with all entries of invalid addresses or misconfigured DNSes...
DNS resolution using latest docker nightly image of Tigase XMPP Server 8.3.0-SNAPSHOT fails to resolve DNS SRV records.