java.net.UnknownHostException exceptions in Confluence log file due to DNS lookups failing
プラットフォームについて: Server および Data Center のみ。この記事は、Server および Data Center プラットフォームのアトラシアン製品にのみ適用されます。
Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Fisheye および Crucible は除く
問題
There are errors in the Confluence log showing that a hostname is unable to be resolved via a DNS server.
This may show up in various formats, but you will see something an error in the file atlassian-confluence.log
:
2013-08-13 14:02:47,223 ERROR [http-8090-17] [core.rest.ui.CreateApplicationLinkUIResource] tryToFetchManifest ManifestNotFoundException thrown while retrieving manifest
-- url: /rest/applinks/1.0/applicationlinkForm/manifest.json | userName: USERNAME | referer: BASE_URL/admin/listapplicationlinks.action
com.atlassian.applinks.spi.manifest.ManifestNotFoundException: java.net.UnknownHostException: HOSTNAME
The example shows the error showing up on an application link, however, this exception can be caused by any part of Confluence or its Add-Ons which needs to connect to a remote network address.
Other examples can be when connecting to api.atlassian.com or to our marketplace.atlassian.com:
...
Caused by: java.net.UnknownHostException: api.atlassian.com: Temporary failure in name resolution
at java.base/java.net.Inet4AddressImpl.lookupAllHostAddr(Native Method)
at java.base/java.net.InetAddress$PlatformNameService.lookupAllHostAddr(Unknown Source)
at java.base/java.net.InetAddress.getAddressesFromNameService(Unknown Source)
at java.base/java.net.InetAddress$NameServiceAddresses.get(Unknown Source)
at java.base/java.net.InetAddress.getAllByName0(Unknown Source)
at java.base/java.net.InetAddress.getAllByName(Unknown Source)
at java.base/java.net.InetAddress.getAllByName(Unknown Source)
at okhttp3.Dns$1.lookup(Dns.java:40)
...
2023-03-29 11:16:11,783 WARN [http-nio-8090-exec-4 url: /, /dashboard.action; user: admin] [atlassian.upm.pac.PacClientImpl] fetchMpacAppInfo Error when querying application info from MPAC: com.atlassian.marketplace.client.MpacException: java.net.UnknownHostException: marketplace.atlassian.com
診断
Log on to the server that is hosting Confluence and try to resolve the hostname which is showing up in the exception, and try to resolve the hostname via DNS manually. For example using the "nslookup" utility which comes by default with most distributions of Linux, and is available on Windows:
nslookup HOSTNAME
Here are some sample diagnoses based on this command's output:
;; connection timed out; no servers could be reached
This means that the DNS resolution servers are not contactable by the server.
** server can't find HOSTNAME: NXDOMAIN
This means that the DNS server is contactable, but can't find an IP address for the host given.
Non-authoritative answer:
Name: HOSTNAME
Address: IP_ADDRESS
This means that the DNS server has cached the IP address for that host, however that server is definitely capable of resolving the IP address for that host name.
原因
There are several causes for this happening in Confluence, including:
- The DNS server is incorrectly specified in the Operating System's configuration.
- The DNS server is correctly specified in the Operating System's configuration, but the DNS server itself is misconfigured
- The hostname that Confluence is attempting to resolve is incorrect
- There is some other network error causing the Confluence server to be unable to reach the DNS server
回避策
It may be possible to work around the issue, if network connectivity is working fine, by specifying the hostname manually in the system's hosts file. This will bypass needing a DNS server to resolve the IP address. This file usually exists in one of the following locations:
- /etc/hosts (Linux)
- %SystemRoot%\system32\drivers\etc\hosts (Windows)
You would simply add a line similar to the following to that file:
10.10.10.10 HOSTNAME.DOMAIN HOSTNAME
Remembering to replace "HOSTNAME.DOMAIN" with the fully-qualified domain name, and "HOSTNAME" with the unqualified domain name.
ソリューション
- If the cause is (1) from above, then configure the Operating System so that the correct DNS server ip address is used.
- If the cause is (2) from above, then diagnose the cause of the DNS server issues, and have them fixed
- If the cause is (3) from above, then find where the hostname is specified in either Confluence's configuration, or an Add-On's configuration, and change to the correct host name
If the cause is (4) from above, then diagnose the cause of the network issues, and have them fixed