Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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!

share|improve this question

2 Answers 2

up vote 11 down vote accepted

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 
share|improve this answer
1  
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

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)

share|improve this answer
    
Thanks, Jovan. I've updated my answer to include that. –  Jim Downing Aug 21 '10 at 7:57

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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