Java: javax.net.ssl.SSLHandshakeException: No subject alternative names matching IP address 10.0.0.5 found
Java checks the hostname against the certificate's SANs and found no matching entry (for DNS names or IPs).
No subject alternative names presentNo subject alternative names matching IP address foundjava.security.cert.CertificateException: No subject alternative DNS name matchingjavax.net.ssl.SSLHandshakeException: No subject alternative names presentNo name matching host found Meaning
Java ignores the legacy Common Name. The certificate must list the host in SAN. When connecting by IP, an IP SAN is required. Reissue the certificate with SANs (-addext subjectAltName=DNS:host,IP:10.0.0.5) or connect using the DNS name.
Common causes
- Certificate has CN only, no SAN
- Connecting via IP not covered by an IP SAN
- Hostname differs from certificate names
- Dev certificates created without SAN
- Wildcard not applying at that level
⚡ Quick fix
- Reissue with SANs including every DNS name/IP used
- Connect by DNS name
- Use mkcert or
openssl req -addextfor development
Detailed fix by platform
Linux
openssl req -x509 -newkey rsa:2048 -nodes -keyout k.pem -out c.pem -days 365 -subj "/CN=localhost" -addext "subjectAltName=DNS:localhost,IP:127.0.0.1"
How to diagnose
- SAN — Present?
- Host — IP or name?
- CN — Only?
🔧 Still not fixed?
Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:
Similar errors
- AH01909: server certificate does NOT include an ID which matches the server name Apache: [ssl:warn] AH01909: example.com:443:0 server certificate does NOT include an ID which matches the server name
- Keystore was tampered with, or password was incorrect Java keytool: java.io.IOException: Keystore was tampered with, or password was incorrect
- no alternative certificate subject name matches target host name curl: (51) SSL: no alternative certificate subject name matches target host name 'example.com'
Most viewed in SSL / TLS
- NET::ERR_CERT_COMMON_NAME_INVALID NET::ERR_CERT_COMMON_NAME_INVALID: Your connection is not private (certificate is for a different domain)
- Challenge failed for domain Let’s Encrypt / Certbot: Challenge failed for domain example.com — Invalid response from http://example.com/.well-known/acme-challenge/x: 404
- no start line OpenSSL: unable to load certificate / PEM routines:get_name:no start line (key values mismatch)
Other ways to find it
Where this error sits
Origin: Network. Errors that are often confused with or caused by this one (click to open):
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
💬 What worked for others
No tips yet — did something else fix this for you?
Share what worked for you
Tips are checked by an editor before they appear. Links are removed.
Report a correction or suggest an improvement
Last updated 4 Nov 2026