Solved: Jetty “null127.0.0.1” error
I have just spent an hour debugging the following problem. Suddenly my Jetty Java web server didn't work any more. Starting it claimed:
Starting Jetty: OK
Yet connecting to the port (telnet localhost 8080) showed that the port was not open. Looking in the logfile (/var/log/jetty6) showed the following error:
2008-11-20 12:08:47.477::WARN: failed SelectChannelConnector@null127.0.0.1:8080 ... Caused by: java.nio.channels.UnresolvedAddressException
That meant that the web server was unable to open the socket on port 8080.
Googling for this error showed only 1 result which lead to a 404. Javadocs and Jetty docs did not mention any problem like that.
Thankfully I had a working system to compare it with. The working system wrote in its logfile:
2008-11-03 13:34:41.283::INFO: Started SelectChannelConnector@0.0.0.0:8080
Notice the difference between 0.0.0.0 (works) and null127.0.0.1 (doesn't work). It turned out that on the good system, the config file /etc/jetty6/jetty.xml had the line
<Set name="host"><SystemProperty name="jetty.host" /></Set>
and the non-working system had:
<Set name="host"><SystemProperty name="jetty.host" />127.0.0.1</Set>
I have absolutely no idea how this non-working line came into the config. I didn't change it, and the operations department surely didn't change it either. I have absolutely no idea.
Why is Java so difficult !?
Jetty 6.1.11, Debian Etch, Linux 2.6.24, Sun Java 1.5