java.net.UnknownHostException: api.example.com
DNS resolution failed for the hostname.
Seen on:
Java
Meaning
Typos, internal hostnames not resolvable from this machine, missing DNS inside containers or no network.
Common causes
- Hostname typo or protocol included
- Internal DNS / VPN required
- Container DNS misconfigured
- Offline
⚡ Quick fix
- nslookup the host from the same machine
- Fix the configured URL
- Check container DNS
Detailed fix by platform
Linux
nslookup api.example.com
How to diagnose
- Host — Exact name
- DNS — Resolves here?
🧠 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.
Was this page helpful?
Report a correction or suggest an improvement
Last updated 2 Oct 2026