Solving 'UnknownHostException' on Linux

Another tip for Ubuntu and Linux users this week. A few times I've had emails to the support inbox along these lines...

I have installed bliss on my Ubuntu laptop. The installation was successful and I could start bliss without errors on the console, however the webpage does not change from: I have it installed with Oracle Java version 8
Problem accessing /. Reason:

    Service Unavailable
Powered by Jetty://

This can actually have a few different causes, but the most common cause on Linux is an inability of the computer running bliss to resolve its own hostname. This doesn't just affect Ubuntu users; it can affect all Linux users depending on your configuration. Indeed, it affected VortexBox users for a while.

So how do you find out this is an issue? The first step is to work out what your hostname is. On the command line:

$ hostname

So study-workstation is the hostname. Now we can see if we can resolve that name by pinging it:

$ ping study-workstation
ping: unknown host study-workstation

Oh dear! We have no way of resolving the host name "study-workstation". You can double check this is the cause by looking in /tmp/bliss.log for UnknownHostException:

2015-02-11 19:27:54,272 (thread FelixStartLevel) WARN  FAILED LiftFilter: study-workstation:study-workstation: unknown error ( study-workstation: study-workstation: unknown error

A simple solution for home/small office setups is to edit your /etc/hosts file to include an entry for the hostname. Here might be something like the default hosts file:       localhost

If we add in the hostname after the line, that should allow us to resolve to the local machine ( is a special IP address that means loop back to the local computer).       localhost study-workstation


$ ping study-workstation
PING study-workstation ( 56(84) bytes of data.
64 bytes from study-workstation ( icmp_seq=1 ttl=64 time=0.044 ms
64 bytes from study-workstation ( icmp_seq=2 ttl=64 time=0.040 ms

That works! It also works for fully qualified names, for example

As a fallback, I wonder if it might be best to try to bind to localhost or

Thanks to CS_McMahon for the image above.
tags: debian redhat dns
blog comments powered by Disqus

The Music Library Management blog

Dan Gravell

I'm Dan, the founder and programmer of bliss. I write bliss to solve my own problems with my digital music collection.