Support Questions

Find answers, ask questions, and share your expertise

Editing Nifi.py for JAVA_HOME

avatar
Contributor

While installing HDF Nifi 2.4 cluster (Ambari) I used Java 7 Installation (option 2). later I also installed java 8, I see a major/minor version conflict while running Nifi. I am not sure changing the default path in my Nifi.py would resolve the issue ? the default JAVA_HOME in this file is /usr/jdk64, which is accessed using a variable 'params.jdk64_home', however I want to change this to /usr/lib/jvm.

My default JAVA_HOME is also set as per new version i.e.

/usr/lib/jvm/java-8-oracle

Plz suggest how can I change this?

5 REPLIES 5

avatar

Hi @Saurabh Verma

If I understand you correctly, below would help:

If you have Java version conflict, and already have latest version installed. Please try updating java property with full path of your java8 binary under services->NiFi->Advanced nifi-bootstrap-env in Ambari as below:

12125-screen-shot-2017-02-03-at-30731-pm.png

Update to like below with your full java 8 path:

12126-screen-shot-2017-02-03-at-32352-pm.png

Once updated, restart the service and see if you still have issues.

if not using Ambari, update below section in./conf/bootstrap.conf file.

# Java command to use when running NiFi

java=java

avatar
Contributor

thanks @Jobin George

But I tried doing this, set the path.. but it still refers to the same jdk64 path in the error file for Nifi Start. I am attaching this file along.

Please suggest how can I update this or directly reset path for $JAVA_HOME.

Please refer to the file below.

error-nifi-start.txt

avatar

Hi @Saurabh Verma,

- Looks like 'NiFi Certificate Authority' is still using the Ambari provided java rather than what you provide in custom configs as well in "Template for nifi-env.sh" [but if you try just starting NiFi individually rather than trying whole service with above provided update NiFi should come up, but not NiFi-CA].

- Do you think Updating java version for Ambari is an option? (hoping it doesn't break anything else). if so, please follow the link below and choose option 3 [Custom JDK] in step 3 and enter your new java home location.

https://docs.hortonworks.com/HDPDocuments/Ambari-2.2.1.1/bk_ambari_reference_guide/content/ch_changi...

Let me know if this helps.

avatar
Contributor

thanks @Jobin George

But I tried doing this, set the path.. but it still refers to the same jdk64 path in the error file for Nifi Start. I am attaching this file along.

Please suggest how can I update this or directly reset path for $JAVA_HOME.

Please refer to the file below.

error-nifi-start.txt

avatar
Master Mentor

@Saurabh Verma

How to change the JDK version for an existing cluster

  1. Re-run Ambari Server Setup.

    ambari-server setup

  2. At the prompt to change the JDK, Enter y.

    Do you want to change Oracle JDK [y/n] (n)? y

  3. At the prompt to choose a JDK, Enter 1 to change the JDK to v1.8.

    [1] - Oracle JDK 1.8

    [2] - Oracle JDK 1.7

    [3] - Custom JDK

  4. If you choose Oracle JDK 1.8 or Oracle JDK 1.7, the JDK you choose downloads and installs automatically on the Ambari Server host. This option requires that you have an internet connection. You must install this JDK on all hosts in the cluster to this same path.
  5. If you choose Custom JDK, verify or add the custom JDK path on all hosts in the cluster. Use this option if you want to use OpenJDK or do not have an internet connection (and have pre-installed the JDK on all hosts).
  6. After setup completes, you must restart each component for the new JDK to be used.
Important
You must also update your JCE security policy files on the Ambari Server and all hosts in the cluster to match the new JDK version. If you do not update the JCE to match the JDK, you may have issues starting services. Refer to the Ambari Security Guide for more information on Installing the JCE.

Thanks,

Matt