nifi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ricky Saltzer (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (NIFI-416) NiFi launcher does not respect JAVA_HOME, fails silently
Date Thu, 12 Mar 2015 18:44:38 GMT

    [ https://issues.apache.org/jira/browse/NIFI-416?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14359150#comment-14359150
] 

Ricky Saltzer commented on NIFI-416:
------------------------------------

The offending code can be found in org/apache/nifi/bootstrap/RunNiFi.java#677

*Snippet*
{code}
String javaCmd = props.get("java");
if ( javaCmd == null ) {
  javaCmd = "java";
}
{code}

I think it might be better if we use the following logic for determining the Java version
to use

Check _conf/bootstrap.conf_ to determine if the default java command is overridden, if so,
use that. If it's not overridden, check if $JAVA_HOME/bin/java is a runnable binary, if it
is, use that. Finally, fall back on using the default value ("java").

If this seems reasonable I'll put up a patch shortly. 

> NiFi launcher does not respect JAVA_HOME, fails silently
> --------------------------------------------------------
>
>                 Key: NIFI-416
>                 URL: https://issues.apache.org/jira/browse/NIFI-416
>             Project: Apache NiFi
>          Issue Type: Bug
>            Reporter: Ricky Saltzer
>
> If you override your JAVA_HOME to another location, the nifi.sh script will use it, but
the RunNiFi launcher will ignore it entirely. This results in a failure with no logging (even
with verbose flag) if your default Java version is too old. See an example below
> {code}
> # Check Java version
> [cops@lannister-001 nifi-0.0.2-incubating-SNAPSHOT]$ java -version
> java version "1.6.0_31"
> Java(TM) SE Runtime Environment (build 1.6.0_31-b04)
> Java HotSpot(TM) 64-Bit Server VM (build 20.6-b01, mixed mode)
> # Override Java version
> [cops@lannister-001 nifi-0.0.2-incubating-SNAPSHOT]$ export JAVA_HOME=/usr/java/jdk1.7.0_67-cloudera/
> # Run NiFi (fails silently)
> [cops@lannister-001 nifi-0.0.2-incubating-SNAPSHOT]$ ./bin/nifi.sh start -verbose
> Java home: /usr/java/jdk1.7.0_67-cloudera/
> NiFi home: /home/cops/nifi-0.0.2-incubating-SNAPSHOT
> Bootstrap Config File: /home/cops/nifi-0.0.2-incubating-SNAPSHOT/conf/bootstrap.conf
> Mar 11, 2015 11:32:44 AM org.apache.nifi.bootstrap.RunNiFi start
> INFO: Starting Apache NiFi...
> Mar 11, 2015 11:32:44 AM org.apache.nifi.bootstrap.RunNiFi start
> INFO: Working Directory: /home/cops/nifi-0.0.2-incubating-SNAPSHOT
> Mar 11, 2015 11:32:44 AM org.apache.nifi.bootstrap.RunNiFi start
> INFO: Command: java -classpath /home/cops/nifi-0.0.2-incubating-SNAPSHOT/./conf:/home/cops/nifi-0.0.2-incubating-SNAPSHOT/./lib/jcl-over-slf4j-1.7.10.jar:/home/cops/nifi-0.0.2-incubating-SNAPSHOT/./lib/slf4j-api-1.7.10.jar:/home/cops/nifi-0.0.2-incubating-SNAPSHOT/./lib/logback-core-1.1.2.jar:/home/cops/nifi-0.0.2-incubating-SNAPSHOT/./lib/nifi-runtime-0.0.2-incubating-SNAPSHOT.jar:/home/cops/nifi-0.0.2-incubating-SNAPSHOT/./lib/nifi-properties-0.0.2-incubating-SNAPSHOT.jar:/home/cops/nifi-0.0.2-incubating-SNAPSHOT/./lib/nifi-api-0.0.2-incubating-SNAPSHOT.jar:/home/cops/nifi-0.0.2-incubating-SNAPSHOT/./lib/logback-classic-1.1.2.jar:/home/cops/nifi-0.0.2-incubating-SNAPSHOT/./lib/log4j-over-slf4j-1.7.10.jar:/home/cops/nifi-0.0.2-incubating-SNAPSHOT/./lib/jul-to-slf4j-1.7.10.jar:/home/cops/nifi-0.0.2-incubating-SNAPSHOT/./lib/nifi-nar-utils-0.0.2-incubating-SNAPSHOT.jar
-Djava.net.preferIPv4Stack=true -Dsun.net.http.allowRestrictedHeaders=true -Djava.protocol.handler.pkgs=sun.net.www.protocol
-Dorg.apache.jasper.compiler.disablejsr199=true -Xmx512m -Xms512m -Dnifi.properties.file.path=/home/cops/nifi-0.0.2-incubating-SNAPSHOT/./conf/nifi.properties
-Dnifi.bootstrap.listen.port=46533 -Dapp=NiFi org.apache.nifi.NiFi
> Mar 11, 2015 11:33:45 AM org.apache.nifi.bootstrap.RunNiFi start
> SEVERE: Apache NiFi does not appear to have started
> {code}
> *Workaround*: Edit the _conf/boostrap.conf_ file and change the java command to the explicit
JDK 1.7 path. 
> For example in my environment:
> {code}
> # Java command to use when running NiFi
> java=/usr/java/jdk1.7.0_67-cloudera/bin/java
> {code}
> {code}
> [cops@lannister-001 nifi-0.0.2-incubating]$ ./bin/nifi.sh run
> Java home: /usr/java/jdk1.7.0_67-cloudera/
> NiFi home: /home/cops/nifi-0.0.2-incubating
> Bootstrap Config File: /home/cops/nifi-0.0.2-incubating/conf/bootstrap.conf
> Mar 12, 2015 11:34:14 AM org.apache.nifi.bootstrap.RunNiFi start
> INFO: Starting Apache NiFi...
> Mar 12, 2015 11:34:14 AM org.apache.nifi.bootstrap.RunNiFi start
> INFO: Working Directory: /home/cops/nifi-0.0.2-incubating
> Mar 12, 2015 11:34:14 AM org.apache.nifi.bootstrap.RunNiFi start
> INFO: Command: /usr/java/jdk1.7.0_67-cloudera/bin/java -classpath /home/cops/nifi-0.0.2-incubating/./conf:/home/cops/nifi-0.0.2-incubating/./lib/jcl-over-slf4j-1.7.10.jar:/home/cops/nifi-0.0.2-incubating/./lib/nifi-properties-0.0.2-incubating.jar:/home/cops/nifi-0.0.2-incubating/./lib/slf4j-api-1.7.10.jar:/home/cops/nifi-0.0.2-incubating/./lib/nifi-nar-utils-0.0.2-incubating.jar:/home/cops/nifi-0.0.2-incubating/./lib/logback-core-1.1.2.jar:/home/cops/nifi-0.0.2-incubating/./lib/logback-classic-1.1.2.jar:/home/cops/nifi-0.0.2-incubating/./lib/log4j-over-slf4j-1.7.10.jar:/home/cops/nifi-0.0.2-incubating/./lib/nifi-api-0.0.2-incubating.jar:/home/cops/nifi-0.0.2-incubating/./lib/jul-to-slf4j-1.7.10.jar:/home/cops/nifi-0.0.2-incubating/./lib/nifi-runtime-0.0.2-incubating.jar
-Djava.net.preferIPv4Stack=true -Dsun.net.http.allowRestrictedHeaders=true -Djava.protocol.handler.pkgs=sun.net.www.protocol
-Dorg.apache.jasper.compiler.disablejsr199=true -Xmx512m -Xms512m -Dnifi.properties.file.path=/home/cops/nifi-0.0.2-incubating/./conf/nifi.properties
-Dnifi.bootstrap.listen.port=45820 -Dapp=NiFi org.apache.nifi.NiFi
> Mar 12, 2015 11:34:14 AM org.apache.nifi.bootstrap.RunNiFi setNiFiCommandControlPort
> INFO: Apache NiFi now running and listening for Bootstrap requests on port 41977
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message