Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 286
datakid Avatar asked Feb 14 '23 21:02

datakid


2 Answers

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

like image 95
user3599132 Avatar answered Feb 16 '23 11:02

user3599132


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.

like image 43
datakid Avatar answered Feb 16 '23 10:02

datakid