Uploaded image for project: 'Flume'
  1. Flume
  2. FLUME-1154

flume-ng script should first try finding java from PATH and then try using bigtop, instead of vice-versa

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 1.2.0
    • 1.2.0
    • Shell
    • None

    Description

      Please see bin/flume-ng script, under the "#find java" section.

      It says:

      1. find java
        if [ -z "${JAVA_HOME}" ] ; then
        echo "Warning: JAVA_HOME not set!"
      2. Try to use Bigtop to autodetect JAVA_HOME if it's available
        if [ -e /usr/libexec/bigtop-detect-javahome ]; then
        . /usr/libexec/bigtop-detect-javahome
        elif [ -e /usr/lib/bigtop-utils/bigtop-detect-javahome ]; then
        . /usr/lib/bigtop-utils/bigtop-detect-javahome
        else
        JAVA_DEFAULT=`type -p java`
        [ -n "$JAVA_DEFAULT" ] || error "Unable to find java executable. Is it in your PATH?" 1
        JAVA_HOME=$(cd $(dirname $JAVA_DEFAULT)/..; pwd)
        fi
        fi

      [ -n "${JAVA_HOME}" ] || error "Unable to find a suitable JAVA_HOME" 1

      ...and this means that if bigtop-detect-javahome was unable to located a java executable. This could happen if the user stores the JDK under his/her own dir in something like /home/<user>/tools/jdk1.6.0_26. The user could have the JDK bin dir in his/her path, but may not necessarily have set JAVA_HOME. If there are no other JDK's available for bigtop-utils to detect, then the current flume-ng script will fail with error saying "Unable to find a suitable JAVA_HOME", even though the java executable was in the PATH.

      So, I recommend doing the "type -p java" check first, and if that results in no match then try bigtop-detect-javahome.

      Attachments

        1. FLUME-1154.patch
          1 kB
          Leslin (Hong Xiang Lin)
        2. FLUME-1154_4.patch
          1 kB
          Leslin (Hong Xiang Lin)
        3. FLUME-1154_3.patch
          0.9 kB
          Leslin (Hong Xiang Lin)
        4. FLUME-1154_2.patch
          0.9 kB
          Leslin (Hong Xiang Lin)
        5. FLUME-1154_1.patch
          1 kB
          Leslin (Hong Xiang Lin)

        Activity

          People

            leslin123 Leslin (Hong Xiang Lin)
            will@cloudera.com Will McQueen
            Votes:
            1 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: