datakid
datakid

Reputation: 2681

Restarting Jetty on Ubuntu 12.04.4

I'm getting some very unusual behaviour.

I followed these instructions for installing jetty but used the latest version instead (9.1.1v20140108)

I had reason to restart Jetty and found I was getting these errors (logged in as root)

Starting Jetty: FAILED Wed Feb 5 12:35:59 EST 2014

So I spent 30 mins looking for an answer, then for reasons I can't recall, I did service jetty check and it was running (had a pid).

So I tried again with service Jetty stop:

root@erp:/var/log# service jetty stop
/etc/init.d/jetty: line 13: chkconfig:: command not found
/etc/init.d/jetty: line 14: description:: command not found
/etc/init.d/jetty: line 15: processname:: command not found
Stopping Jetty: start-stop-daemon: warning: failed to kill 7817: No such process
1 pids were not killed
No process in pidfile '/var/run/jetty.pid' found running; none killed.
OK

None killed? Ok. Let's check that:

root@erp:/var/log# service jetty check
/etc/init.d/jetty: line 13: chkconfig:: command not found
/etc/init.d/jetty: line 14: description:: command not found
/etc/init.d/jetty: line 15: processname:: command not found
Checking arguments to Jetty:
START_INI      =  /srv/jetty/start.ini
JETTY_HOME     =  /srv/jetty
JETTY_BASE     =  /srv/jetty
JETTY_CONF     =  /srv/jetty/etc/jetty.conf
JETTY_PID      =  /var/run/jetty.pid
JETTY_START    =  /srv/jetty/start.jar
JETTY_LOGS     =  /srv/jetty/logs
CLASSPATH      =
JAVA           =  /usr/bin/java
JAVA_OPTIONS   =  -Dsolr.solr.home=/srv/solr  -Djetty.state=/srv/jetty/jetty.state -Djetty.logs=/srv/jetty/logs -Djetty.home=/srv/jetty -Djetty.base=/srv/jetty -Djava.io.tmpdir=/tmp
JETTY_ARGS     =  jetty.port=8085 jetty-logging.xml jetty-started.xml
RUN_CMD        =  /usr/bin/java -Dsolr.solr.home=/srv/solr -Djetty.state=/srv/jetty/jetty.state -Djetty.logs=/srv/jetty/logs -Djetty.home=/srv/jetty -Djetty.base=/srv/jetty -Djava.io.tmpdir=/tmp -jar /srv/jetty/start.jar jetty.port=8085 jetty-logging.xml jetty-started.xml

No PID? Let's check that:

root@erp:/var/log# service jetty start
/etc/init.d/jetty: line 13: chkconfig:: command not found
/etc/init.d/jetty: line 14: description:: command not found
/etc/init.d/jetty: line 15: processname:: command not found
Starting Jetty: FAILED Wed Feb  5 12:39:43 EST 2014

Ok, is there a PID?

root@erp:/var/log# service jetty check
/etc/init.d/jetty: line 13: chkconfig:: command not found
/etc/init.d/jetty: line 14: description:: command not found
/etc/init.d/jetty: line 15: processname:: command not found
Checking arguments to Jetty: 
[edit]

Jetty running pid=7993

Weird. Sure enough, a stop and check will give the same results.

What's going on with the jetty startup script? And why am I getting FAILED errors on start which are incorrect, and fail to remove pid errors on stop which are also incorrect?

Upvotes: 4

Views: 12890

Answers (4)

Gayan Chinthaka
Gayan Chinthaka

Reputation: 569

Try running below command in terminal.

sudo service jetty9 stop

Upvotes: 1

jmasa
jmasa

Reputation: 25

I run Jetty 9.2.10.v201503 on pcDuino v3, Ubuntu 14.04. According to my experience with this relatively slow platform, this message may be reported when Jetty server itself starts longer than internal waiting loop in /etc/init.d/jetty script expects.

After adding “set –x” at the beginning of /etc/init.d/jetty file and running that script I noticed that internal waiting loop is implemented as “for” making 15 steps and periodically checking content of the $JETTY_BASE/jetty.state file. After waiting additional couple of seconds, Jetty server is up and running ok, no errors/warrnings in log files.

Upvotes: -1

user3599132
user3599132

Reputation: 71

I have got a fix for all those who have been using that tutorial to install jetty

nano /etc/init.d/jetty

And change this syntax :

start-log-file="$JETTY_LOGS/start.log"

to

start-log-file="start.log"

It will fix everything in the latest jetty build and make it run like a charm.

Hope I could be of help

Upvotes: 7

datakid
datakid

Reputation: 2681

Ok, so this was a tricky one that was the result of a recent Java update.

I jumped into the jetty.sh at /etc/init.d/jetty and grabbed out the actually executed line:

$ /usr/bin/java -Dsolr.solr.home=/srv/solr -Djetty.state=/srv/jetty/jetty.state \
-Djetty.logs=/srv/jetty/logs -Djetty.home=/srv/jetty -Djetty.base=/srv/jetty  \
-Djava.io.tmpdir=/tmp -jar /srv/jetty/start.jar jetty.port=8085 \ 
jetty-logging.xml jetty-started.xml

and I got this:

java.io.IOException: Cannot read file: modules/npn/npn-1.7.0_51.mod
    at org.eclipse.jetty.start.Modules.registerModule(Modules.java:405)
    at org.eclipse.jetty.start.Modules.registerAll(Modules.java:395)
    at org.eclipse.jetty.start.Main.processCommandLine(Main.java:561)
    at org.eclipse.jetty.start.Main.main(Main.java:102)

Which in turn lead me to this solution on the eclipse dev list:

$ cp /srv/jetty/modules/npn/npn-1.7.0_45.mod /srv/jetty/modules/npn/npn-1.7.0_51.mod
$ chown jetty:jetty /srv/jetty/modules/npn/npn-1.7.0_51.mod

Sure enough, Jetty restarted without hassle.

Upvotes: 1

Related Questions