pentaho/pentaho-kettle · error · NamingException
MailValidator.NoMatchName
Error message
MailValidator.NoMatchName
What it means
MailValidation.getMX() throws this NamingException when performing SMTP validation: if a domain has no MX records, it falls back to querying the 'A' record for the host, and if that lookup also returns null it means DNS knows nothing about the host. The message includes the hostName that failed to resolve.
Solutions
- Verify the email domain actually exists (e.g. `nslookup -type=MX domain`).
- Check DNS server configuration / resolv.conf on the machine running the transformation.
- Disable SMTP check in the Mail Validator step if you only need syntax validation.
- Ensure the JVM has network access and correct dnsjava/JNDI provider settings.
Defensive patterns
Strategy: validation
Validate before calling
// Before enabling SMTP check, verify DNS resolution of the domain
String domain = email.substring( email.indexOf( '@' ) + 1 );
javax.naming.directory.DirContext ictx = ...;
try {
ictx.getAttributes( domain, new String[] { "MX", "A" } );
} catch ( NamingException e ) {
fail( "Domain not resolvable: " + domain );
} Try / catch
try {
valid = MailValidation.isAddressValid( email );
} catch ( NamingException e ) {
// treat as 'cannot validate' rather than invalid address
log.logBasic( "DNS lookup failed for domain: " + e.getMessage() );
valid = false;
} Prevention
- Pre-validate email domains with a DNS lookup before SMTP check.
- Test DNS from the transformation host (nslookup/dig).
- Only enable SMTP check when network + DNS access is guaranteed.
- Sanitize/validate email syntax before domain lookups.
When it happens
Trigger: SMTP check enabled on the Mail Validator step; DNS lookup of MX records returns empty and the subsequent 'A' record lookup via JNDI DirContext returns null for the email domain.
Common situations: Email address contains a misspelled or nonexistent domain; DNS server unreachable or misconfigured; domain exists but has neither MX nor A records; testing in an isolated network without DNS access.
Understand the failure class
Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.
Related errors
- HTTP.Error.UnknownHostException
- HTTPPOST.Error.UnknownHostException
- MailValidator.Error.DefaultSMTPFieldMissing
- sendMail: " + e.toString()
- sendMail
AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13).
Data as JSON: /api/errors/07ac304edf1b484a.
Report an issue: GitHub.
Appendix: source
Thrown at plugins/mail-validator/impl/src/main/java/org/pentaho/di/trans/steps/mailvalidator/MailValidation.java:104
wr.flush();
return;
}
private static ArrayList<String> getMX( String hostName ) throws NamingException {
// Perform a DNS lookup for MX records in the domain
Hashtable<String, String> env = new Hashtable<String, String>();
env.put( "java.naming.factory.initial", "com.sun.jndi.dns.DnsContextFactory" );
DirContext ictx = new InitialDirContext( env );
Attributes attrs = ictx.getAttributes( hostName, new String[] { "MX" } );
Attribute attr = attrs.get( "MX" );
// if we don't have an MX record, try the machine itself
if ( ( attr == null ) || ( attr.size() == 0 ) ) {
attrs = ictx.getAttributes( hostName, new String[] { "A" } );
attr = attrs.get( "A" );
if ( attr == null ) {
throw new NamingException( BaseMessages.getString( PKG, "MailValidator.NoMatchName", hostName ) );
}
}
// Huzzah! we have machines to try. Return them as an array list
// NOTE: We SHOULD take the preference into account to be absolutely
// correct. This is left as an exercise for anyone who cares.
ArrayList<String> res = new ArrayList<String>();
NamingEnumeration<?> en = attr.getAll();
while ( en.hasMore() ) {
String x = (String) en.next();
String[] f = x.split( " " );
if ( f[1].endsWith( "." ) ) {
f[1] = f[1].substring( 0, ( f[1].length() - 1 ) );
}
res.add( f[1] );
}
return res;View on GitHub (pinned to f3058517a1)