JAVA_HOME trouble in nifi.sh

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

JAVA_HOME trouble in nifi.sh

Peter Wicks (pwicks)
Only when building on Linux, during build my "${JAVA_HOME}" string in nifi.sh is getting overwritten by the current value of my environment variable for JAVA_HOME on my build box... not sure if this is something others have run into.

I built on one box, where JAVA_HOME is set to "/var/spe/tools/jdk1.8.0_144". I then copied the tar.gz directly from nifi-assembly to another box. I only extracted it after getting to the other server where JAVA_HOME is not set.

Here is a snippet from nifi.sh, I've bolded the sections where the raw file has ${JAVA_HOME}. Mabye this is a system config issue? Obviously this isn't happening for everyone else building on Linux...?

locateJava() {
    # Setup the Java Virtual Machine
    if $cygwin ; then
        [ -n "${JAVA}" ] && JAVA=$(cygpath --unix "${JAVA}")
        [ -n "/var/spe/tools/jdk1.8.0_144" ] && JAVA_HOME=$(cygpath --unix "/var/spe/tools/jdk1.8.0_144")
    fi

    if [ "x${JAVA}" = "x" ] && [ -r /etc/gentoo-release ] ; then
        JAVA_HOME=$(java-config --jre-home)
    fi
    if [ "x${JAVA}" = "x" ]; then
        if [ "x/var/spe/tools/jdk1.8.0_144" != "x" ]; then
            if [ ! -d "/var/spe/tools/jdk1.8.0_144" ]; then
                die "JAVA_HOME is not valid: /var/spe/tools/jdk1.8.0_144"
            fi
            JAVA="/var/spe/tools/jdk1.8.0_144/bin/java"
        else
            warn "JAVA_HOME not set; results may vary"
            JAVA=$(type java)
            JAVA=$(expr "${JAVA}" : '.* \(/.*\)$')
            if [ "x${JAVA}" = "x" ]; then
                die "java command not found"
            fi
        fi
    fi
    # if command is env, attempt to add more to the classpath
    if [ "$1" = "env" ]; then
        [ "x${TOOLS_JAR}" =  "x" ] && [ -n "/var/spe/tools/jdk1.8.0_144" ] && TOOLS_JAR=$(find -H "/var/spe/tools/jdk1.8.0_144" -name "tools.jar")
        [ "x${TOOLS_JAR}" =  "x" ] && [ -n "/var/spe/tools/jdk1.8.0_144" ] && TOOLS_JAR=$(find -H "/var/spe/tools/jdk1.8.0_144" -name "classes.jar")
        if [ "x${TOOLS_JAR}" =  "x" ]; then
             warn "Could not locate tools.jar or classes.jar. Please set manually to avail all command features."
        fi
    fi

}
Reply | Threaded
Open this post in threaded view
|

Re: JAVA_HOME trouble in nifi.sh

Aldrin Piri
Can't say I've seen this before and certainly have JAVA_HOME set on most of
the places where I've performed builds.  Would you mind please opening up a
ticket as well as capturing the salient environmental bits (OS, Maven, JDK
versions, etc)?

That locateJava blurb is something we used from another ASF project and use
heavily throughout our executables, so definitely need to track it down.

Did you happen to see this substitution in any other files?

On Thu, Oct 12, 2017 at 10:51 PM, Peter Wicks (pwicks) <[hidden email]>
wrote:

> Only when building on Linux, during build my "${JAVA_HOME}" string in
> nifi.sh is getting overwritten by the current value of my environment
> variable for JAVA_HOME on my build box... not sure if this is something
> others have run into.
>
> I built on one box, where JAVA_HOME is set to
> "/var/spe/tools/jdk1.8.0_144". I then copied the tar.gz directly from
> nifi-assembly to another box. I only extracted it after getting to the
> other server where JAVA_HOME is not set.
>
> Here is a snippet from nifi.sh, I've bolded the sections where the raw
> file has ${JAVA_HOME}. Mabye this is a system config issue? Obviously this
> isn't happening for everyone else building on Linux...?
>
> locateJava() {
>     # Setup the Java Virtual Machine
>     if $cygwin ; then
>         [ -n "${JAVA}" ] && JAVA=$(cygpath --unix "${JAVA}")
>         [ -n "/var/spe/tools/jdk1.8.0_144" ] && JAVA_HOME=$(cygpath --unix
> "/var/spe/tools/jdk1.8.0_144")
>     fi
>
>     if [ "x${JAVA}" = "x" ] && [ -r /etc/gentoo-release ] ; then
>         JAVA_HOME=$(java-config --jre-home)
>     fi
>     if [ "x${JAVA}" = "x" ]; then
>         if [ "x/var/spe/tools/jdk1.8.0_144" != "x" ]; then
>             if [ ! -d "/var/spe/tools/jdk1.8.0_144" ]; then
>                 die "JAVA_HOME is not valid: /var/spe/tools/jdk1.8.0_144"
>             fi
>             JAVA="/var/spe/tools/jdk1.8.0_144/bin/java"
>         else
>             warn "JAVA_HOME not set; results may vary"
>             JAVA=$(type java)
>             JAVA=$(expr "${JAVA}" : '.* \(/.*\)$')
>             if [ "x${JAVA}" = "x" ]; then
>                 die "java command not found"
>             fi
>         fi
>     fi
>     # if command is env, attempt to add more to the classpath
>     if [ "$1" = "env" ]; then
>         [ "x${TOOLS_JAR}" =  "x" ] && [ -n "/var/spe/tools/jdk1.8.0_144" ]
> && TOOLS_JAR=$(find -H "/var/spe/tools/jdk1.8.0_144" -name "tools.jar")
>         [ "x${TOOLS_JAR}" =  "x" ] && [ -n "/var/spe/tools/jdk1.8.0_144" ]
> && TOOLS_JAR=$(find -H "/var/spe/tools/jdk1.8.0_144" -name "classes.jar")
>         if [ "x${TOOLS_JAR}" =  "x" ]; then
>              warn "Could not locate tools.jar or classes.jar. Please set
> manually to avail all command features."
>         fi
>     fi
>
> }
>
Reply | Threaded
Open this post in threaded view
|

RE: [EXT] Re: JAVA_HOME trouble in nifi.sh

Peter Wicks (pwicks)
Aldrin,

My branch isn't  pure, in fact it has a few build only related changes... I'll play around with it.

I'm working on moving my builds to a Unix box with Jenkins to reduce the CPU strain on my development box. But my builds were failing due to the NPM/Node Maven plugin. So I upgraded the package version to get the build to complete.

Since the build did not complete before this update I have no idea how it may have affected the build.

Thanks,
  Peter

-----Original Message-----
From: Aldrin Piri [mailto:[hidden email]]
Sent: Friday, October 13, 2017 10:25 PM
To: dev <[hidden email]>
Subject: [EXT] Re: JAVA_HOME trouble in nifi.sh

Can't say I've seen this before and certainly have JAVA_HOME set on most of the places where I've performed builds.  Would you mind please opening up a ticket as well as capturing the salient environmental bits (OS, Maven, JDK versions, etc)?

That locateJava blurb is something we used from another ASF project and use heavily throughout our executables, so definitely need to track it down.

Did you happen to see this substitution in any other files?

On Thu, Oct 12, 2017 at 10:51 PM, Peter Wicks (pwicks) <[hidden email]>
wrote:

> Only when building on Linux, during build my "${JAVA_HOME}" string in
> nifi.sh is getting overwritten by the current value of my environment
> variable for JAVA_HOME on my build box... not sure if this is
> something others have run into.
>
> I built on one box, where JAVA_HOME is set to
> "/var/spe/tools/jdk1.8.0_144". I then copied the tar.gz directly from
> nifi-assembly to another box. I only extracted it after getting to the
> other server where JAVA_HOME is not set.
>
> Here is a snippet from nifi.sh, I've bolded the sections where the raw
> file has ${JAVA_HOME}. Mabye this is a system config issue? Obviously
> this isn't happening for everyone else building on Linux...?
>
> locateJava() {
>     # Setup the Java Virtual Machine
>     if $cygwin ; then
>         [ -n "${JAVA}" ] && JAVA=$(cygpath --unix "${JAVA}")
>         [ -n "/var/spe/tools/jdk1.8.0_144" ] && JAVA_HOME=$(cygpath
> --unix
> "/var/spe/tools/jdk1.8.0_144")
>     fi
>
>     if [ "x${JAVA}" = "x" ] && [ -r /etc/gentoo-release ] ; then
>         JAVA_HOME=$(java-config --jre-home)
>     fi
>     if [ "x${JAVA}" = "x" ]; then
>         if [ "x/var/spe/tools/jdk1.8.0_144" != "x" ]; then
>             if [ ! -d "/var/spe/tools/jdk1.8.0_144" ]; then
>                 die "JAVA_HOME is not valid: /var/spe/tools/jdk1.8.0_144"
>             fi
>             JAVA="/var/spe/tools/jdk1.8.0_144/bin/java"
>         else
>             warn "JAVA_HOME not set; results may vary"
>             JAVA=$(type java)
>             JAVA=$(expr "${JAVA}" : '.* \(/.*\)$')
>             if [ "x${JAVA}" = "x" ]; then
>                 die "java command not found"
>             fi
>         fi
>     fi
>     # if command is env, attempt to add more to the classpath
>     if [ "$1" = "env" ]; then
>         [ "x${TOOLS_JAR}" =  "x" ] && [ -n
> "/var/spe/tools/jdk1.8.0_144" ] && TOOLS_JAR=$(find -H "/var/spe/tools/jdk1.8.0_144" -name "tools.jar")
>         [ "x${TOOLS_JAR}" =  "x" ] && [ -n
> "/var/spe/tools/jdk1.8.0_144" ] && TOOLS_JAR=$(find -H "/var/spe/tools/jdk1.8.0_144" -name "classes.jar")
>         if [ "x${TOOLS_JAR}" =  "x" ]; then
>              warn "Could not locate tools.jar or classes.jar. Please
> set manually to avail all command features."
>         fi
>     fi
>
> }
>