Bitbucket Server Fails to Start Up with java.net.UnknownHostException Exception

Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.

Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. 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.

*Except Fisheye and Crucible

Summary

Symptoms

The following exception is reported when starting up Bitbucket Server:

1 2 3 4 5 6 7 2012-10-02 00:19:15,294 ERROR [main] o.s.web.context.ContextLoader Context initialization failed java.lang.RuntimeException: java.net.UnknownHostException: server.localdomain: <Host_Name>: Name or service not known Caused by: java.net.UnknownHostException: server.localdomain: server.localdomain: Name or service not known at java.net.InetAddress.getLocalHost(InetAddress.java:1438) ~[na:1.7.0_07] at com.atlassian.security.auth.trustedapps.UIDGenerator.generateUID(UIDGenerator.java:25) ~[atlassian-trusted-apps-core-2.5.2.jar:na] ... 51 common frames omitted Caused by: java.net.UnknownHostException: <Host_Name>: Name or service not known

Diagnosis

  1. Check if the application is accessible directly on the machine hosting the Bitbucket Server instance, using localhost - http://localhost:7990/

  2. Check what is the IP address that the hostname resolves to and use that IP address directly to access the application.

  3. Check if network is configured correctly using ifconfig -a (for Linux) / ipconfig /all (for Windows)

Cause

Bitbucket Server is unable to identify the hostname being used to access the application.

Solution

Resolution

  1. Add the host name to your hosts file. Usually adding the <hostname> exposed on the log above to the /etc/hostsof Bitbucket Server instance, associating it to 127.0.0.1 followed by a Bitbucket Server restart will solve the problem. The entry in /etc/hosts should resemble the following:

    1 127.0.0.1 hostname
  2. If using a DNS server ensure that the service resolves the queries for the hostname into the correct IP address.

Updated on April 15, 2025

Still need help?

The Atlassian Community is here for you.