# java.net.UnknownHostException: api.example.com

**Code:** `UnknownHostException` · **Category:** Java · **Seen on:** Java

DNS resolution failed for the hostname.

## 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

1. nslookup the host from the same machine
2. Fix the configured URL
3. Check container DNS

## Detailed fix by platform

### Linux

1. `nslookup api.example.com`

## How to diagnose

1. **Host** — Exact name
2. **DNS** — Resolves here?

---
Source: [WhatIsMyError](https://whatismyerror.com/errors/java/unknownhostexception)
