Configuring Jetty to accept connections from all hosts on Ubuntu Lucid
Solution 1
Found it! You need: -
JETTY_HOST=0.0.0.0
to listen to other hosts. So a minimal /etc/default/jetty file includes: -
JAVA_HOME=/usr/lib/jvm/java-1.5.0-sun
NO_START=0
JETTY_HOST=0.0.0.0
JETTY_PORT=8080
Solution 2
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=0.0.0.0 # 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
)
Related videos on Youtube
Jim Downing
12 years experience programming various bits of Java, JavaScript, SQL, Clojure etc etc, also bits of TechOps work.
Updated on September 17, 2022Comments
-
Jim Downing almost 2 years
I want Jetty to serve connections from any host on port 8080. My
/etc/default/jetty
file has: -NO_START=0 JETTY_HOST= JETTY_PORT=8080
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 0.0.0.0:22 0.0.0.0:* LISTEN 413/sshd tcp6 0 0 127.0.0.1:8080 :::* LISTEN 5655/jsvc tcp6 0 0 :::22 :::* LISTEN 413/sshd udp 0 0 0.0.0.0:68 0.0.0.0:* 260/dhclient3 Active UNIX domain sockets (only servers) Proto RefCnt Flags Type State I-Node PID/Program name P ath unix 2 [ ACC ] STREAM LISTENING 1407 1/init @ /com/ubuntu/upstart unix 2 [ ACC ] STREAM LISTENING 4021 407/dbus-daemon / var/run/dbus/system_bus_socket
Any ideas on why my Jetty config doesn't seem to be listening to other hosts would be greatly appreciated!
-
mkm about 13 yearssome jetty distributions don't pass JETTY_HOST env var. add
-Djetty.port=$JETTY_PORT
to the JAVA_OPTIONS env (or similar) -
Synchro over 12 yearsFor some odd reason on Ubuntu this option is labelled as being which hosts jetty will accept connections from. Had me fooled for a while.
-
Ludovic Kuty over 9 yearsYou can also use
JETTY_ARGS
in/etc/default/jetty
(with double quotes):JETTY_ARGS="jetty.host=127.0.0.1 jetty.port=8080 jetty.spdy.port=8443 jetty.secure.port=443"