Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 316970

Summary: jetty.sh fails to find JETTY_HOME in standard directories
Product: [RT] Jetty Reporter: Barry Pearce <netsupport>
Component: otherAssignee: Joakim Erdfelt <joakim.erdfelt>
Status: CLOSED FIXED QA Contact:
Severity: major    
Priority: P3 CC: gregw, joakim.erdfelt, mgorovoy
Version: 7.1.4   
Target Milestone: 7.1.x   
Hardware: PC   
OS: Linux   
Whiteboard:

Description Barry Pearce CLA 2010-06-15 16:33:45 EDT
Build Identifier: jetty-hightide-7.1.4.v20100610.tar.gz

Ubuntu Karmic Koala 9.10 fully updated.
Jetty hightide 7.1.3 works. 7.1.4 fails with the message:

** ERROR: JETTY_HOME not set, you need to set it or install in a standard location.

This is despite the fact jetty is installed in /usr/local/jetty.

The for loops starting on line 209 have had their structure changed. The manipulation and reseting of JETTY_HOME on line 213 means that a single test and break is not enough to exit the for loops. After the done a second test and break is required to correctly exit the outer loop.

Result:  Jetty will never start.


Reproducible: Always

Steps to Reproduce:
1. service jetty start
2.
3.
Comment 1 Joakim Erdfelt CLA 2010-06-15 17:33:20 EDT
Just installed Jetty on Ubuntu Lucid in /usr/local/jetty and was able to start it successfully with both jetty-distribution-7.1.4.v20100610 and jetty-hightide-7.1.4.v20100610

No JETTY_HOME error for me.

Can you provide more details?
Comment 2 Barry Pearce CLA 2010-06-16 05:00:16 EDT
This is on an ubuntu karmic koala install.

Here is the code in error:

  for L in "${STANDARD_LOCATIONS[@]}"
  do
    for N in "${JETTY_DIR_NAMES[@]}"
    do
      JETTY_HOME=("$L/"$N)
      if [ ! -d "$JETTY_HOME" ] || [ ! -f "$JETTY_HOME/$JETTY_INSTALL_TRACE_FILE" ]
      then
        JETTY_HOME=
      fi
      [ "$JETTY_HOME" ] && break
    done
  done


The break will only break 1 loop not 2. The fix is either to use 'break 2' or insert a duplicate test/break line between the two done lines.

Hope this helps.
Comment 3 Barry Pearce CLA 2010-06-16 05:02:20 EDT
I hasten to add that if jetty is installed to the last standard location or JETTY_HOME is set in the calling environment (unlikely if called using the service command) or JETTY_HOME is specified in /etc/default/jetty* then the script will not show an error and will work as expected.
Comment 4 Joakim Erdfelt CLA 2010-06-16 17:26:18 EDT
Fix committed to trunk r2018

The JETTY_HOME lookup loops have been reworked to be more clear and more resilient (with documentation).