Skip to content
Advertisement

Java failure in looking up the MX record for specific domain

Here’s a piece of code demonstrating a case where the Java standard extensions for working with DNS fail to correctly look up the MX record for a specific domain, while the dig utility has no problem doing so. I have replicated this across different machines, networks, and operating systems (AWS Ubuntu, Linode CentOS, local Windows).

JavaScript

Meanwhile, here’s dig:

JavaScript

What could be the problem? I’m interested in reliably looking up MX records from Java.

Environment:

JavaScript

Advertisement

Answer

designercakesbyapril.com is not configured correctly.

Requests reply with a CNAME record which is invalid there because at apex. Hence you will get erratic behavior, and the problem is not in your program but in this domain DNS configuration that needs to be fixed.

JavaScript

(and note how it fails as the last name does not have an MX record either)

You can see at https://dnsviz.net/d/designercakesbyapril.com/YjpWYQ/dnssec/ (an online DNS troubleshooting tool) how broken this domain name is (15 errors, 6 warnings).

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement