I want Jetty to serve connections from any host on port 8080. My /etc/default/jetty file has: -


The server is an EC2 small instance based on a Lucid Lynx 32 bit server AMI. APT is configured with multiverse enabled, and the canonical partner repository enabled. Jetty is 6.1.22 from from the partner repository.

When I start jetty using sudo /etc/init.d jetty start, it works, and listens to connections from localhost, but not to any others: -

ubuntu@ip-10-224-70-51:/etc/network/if-pre-up.d$ sudo netstat -nlp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State
PID/Program name
tcp        0      0    *               LISTEN
tcp6       0      0          :::*                    LISTEN
tcp6       0      0 :::22                   :::*                    LISTEN
udp        0      0    *
Active UNIX domain sockets (only servers)
Proto RefCnt Flags       Type       State         I-Node   PID/Program name    P
unix  2      [ ACC ]     STREAM     LISTENING     1407     1/init              @
unix  2      [ ACC ]     STREAM     LISTENING     4021     407/dbus-daemon     /

Any ideas on why my Jetty config doesn't seem to be listening to other hosts would be greatly appreciated!


Found it! You need: -


to listen to other hosts. So a minimal /etc/default/jetty file includes: -

  • 2
    some jetty distributions don't pass JETTY_HOST env var. add -Djetty.port=$JETTY_PORT to the JAVA_OPTIONS env (or similar) – ithkuil Apr 8 '11 at 8:23
  • For some odd reason on Ubuntu this option is labelled as being which hosts jetty will accept connections from. Had me fooled for a while. – Synchro Feb 14 '12 at 8:28
  • You can also use JETTY_ARGS in /etc/default/jetty (with double quotes): JETTY_ARGS="jetty.host= jetty.port=8080 jetty.spdy.port=8443 jetty.secure.port=443" – Ludovic Kuty Jan 29 '15 at 13:29

For anyone that want's to use Jetty on Ubuntu with Sun's Java JDK, these are the things that need to be changed /etc/default/jetty file:

NO_START=0    # so jetty can be started.

JETTY_HOST=    # so jetty listens to all hosts.

JETTY_PORT=8999    # optionally, port on which jetty listens (in my case 8999).

JAVA_HOME=/usr/lib/jvm/java-1.5.0-sun    # very important, your JAVA_HOME dir.

That's all what is needed to run jetty on ubuntu. (I spent an hour and realised I was missing JAVA_HOME though I do have it defined in .bashrc)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.