Unable to start NiFi on an EC2 instance

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

Unable to start NiFi on an EC2 instance

James McMahon
Good evening. I downloaded NiFi 1.3.0 to a linux EC2 instance in AWS I recently created. A uname -or tells me the version of Linux I am running: 4.9.20-11.31.amzn1.x86_64 GNU/Linux


I tried to establish nifi as a service. I was the root user - not the nifi user - I changed to the bin directory of my nifi installation and ran
./nifi.sh install
I got this small /etc/init.d/nifi file:

NIFI_HOME=/local/opt/nifi/nifi-1.3.0
bin_dir=${NIFI_HOME}/bin
nifi_executable=${bin_dir}/nifi.sh

${nifi_executable} "$@"

I then executed 
service nifi start
I expected the service to start owned by user nifi, because in my bootstrap.conf file I set
run.as=nifi

It never started. I got this error:
[root@ip-10-0-0-21 init.d]# service nifi start
nifi.sh: JAVA_HOME not set; results may vary

Java home:
NiFi home: /local/opt/nifi/nifi-1.3.0

Bootstrap Config File: /local/opt/nifi/nifi-1.3.0/conf/bootstrap.conf

Exception in thread "main" java.lang.UnsupportedClassVersionError: org/apache/nifi/bootstrap/RunNiFi : Unsupported major.minor version 52.0
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:803)
        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
        at java.net.URLClassLoader.defineClass(URLClassLoader.java:442)
        at java.net.URLClassLoader.access$100(URLClassLoader.java:64)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:354)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:348)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:347)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
        at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:482)

I tried to determine what version of java, and this is what I learned:
[root@ip-10-0-0-21 init.d]# which java
/usr/bin/java
[root@ip-10-0-0-21 init.d]# ls -tl /usr/bin/java
lrwxrwxrwx 1 root root 22 Apr 17 07:58 /usr/bin/java -> /etc/alternatives/java
[root@ip-10-0-0-21 init.d]# ls -tl /etc/alternatives/java
lrwxrwxrwx 1 root root 46 Apr 17 07:58 /etc/alternatives/java -> /usr/lib/jvm/jre-1.7.0-openjdk.x86_64/bin/java
[root@ip-10-0-0-21 init.d]# uname -or
4.9.20-11.31.amzn1.x86_64 GNU/Linux
[root@ip-10-0-0-21 init.d]#

As user nifi, I try to determine my java version but it cannot find javac:
[nifi@ip-10-0-0-21 conf]$ javac -version
bash: javac: command not found

I started an EC2 that is supposed to have java on it but evidently it must not.

So my questions:
* has anyone conquered this problem, and if so can you offer any guidance?
* Does that jre-1.7.0 mean I am doomed from the start here because NiFi 1.3.0 requires java 8?
* should I run the run/sh install to set up as a service as root?

Thank you in advance for any help.-Jim
Reply | Threaded
Open this post in threaded view
|

Re: Unable to start NiFi on an EC2 instance

Aldrin Piri
Hi James!

NiFi 1.0+ explicitly requires Java 8. 

As far as service installation, it is likely needed to be done as root for touching those parts of the system. 

Would also suggest using the script to install the service.

Let us know if you hit hurdles after getting JRE 8 installed. 

Aldrin Piri 
Sent from my mobile device. 

On Jun 12, 2017, at 17:46, James McMahon <[hidden email]> wrote:

Good evening. I downloaded NiFi 1.3.0 to a linux EC2 instance in AWS I recently created. A uname -or tells me the version of Linux I am running: 4.9.20-11.31.amzn1.x86_64 GNU/Linux


I tried to establish nifi as a service. I was the root user - not the nifi user - I changed to the bin directory of my nifi installation and ran
./nifi.sh install
I got this small /etc/init.d/nifi file:

NIFI_HOME=/local/opt/nifi/nifi-1.3.0
bin_dir=${NIFI_HOME}/bin
nifi_executable=${bin_dir}/nifi.sh

${nifi_executable} "$@"

I then executed 
service nifi start
I expected the service to start owned by user nifi, because in my bootstrap.conf file I set
run.as=nifi

It never started. I got this error:
[root@ip-10-0-0-21 init.d]# service nifi start
nifi.sh: JAVA_HOME not set; results may vary

Java home:
NiFi home: /local/opt/nifi/nifi-1.3.0

Bootstrap Config File: /local/opt/nifi/nifi-1.3.0/conf/bootstrap.conf

Exception in thread "main" java.lang.UnsupportedClassVersionError: org/apache/nifi/bootstrap/RunNiFi : Unsupported major.minor version 52.0
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:803)
        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
        at java.net.URLClassLoader.defineClass(URLClassLoader.java:442)
        at java.net.URLClassLoader.access$100(URLClassLoader.java:64)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:354)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:348)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:347)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
        at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:482)

I tried to determine what version of java, and this is what I learned:
[root@ip-10-0-0-21 init.d]# which java
/usr/bin/java
[root@ip-10-0-0-21 init.d]# ls -tl /usr/bin/java
lrwxrwxrwx 1 root root 22 Apr 17 07:58 /usr/bin/java -> /etc/alternatives/java
[root@ip-10-0-0-21 init.d]# ls -tl /etc/alternatives/java
lrwxrwxrwx 1 root root 46 Apr 17 07:58 /etc/alternatives/java -> /usr/lib/jvm/jre-1.7.0-openjdk.x86_64/bin/java
[root@ip-10-0-0-21 init.d]# uname -or
4.9.20-11.31.amzn1.x86_64 GNU/Linux
[root@ip-10-0-0-21 init.d]#

As user nifi, I try to determine my java version but it cannot find javac:
[nifi@ip-10-0-0-21 conf]$ javac -version
bash: javac: command not found

I started an EC2 that is supposed to have java on it but evidently it must not.

So my questions:
* has anyone conquered this problem, and if so can you offer any guidance?
* Does that jre-1.7.0 mean I am doomed from the start here because NiFi 1.3.0 requires java 8?
* should I run the run/sh install to set up as a service as root?

Thank you in advance for any help.-Jim
Reply | Threaded
Open this post in threaded view
|

Re: Unable to start NiFi on an EC2 instance

James McMahon
Will do. Thanks very much Aldrin. I will work on getting Java 8 installed this morning, and then retry starting it as a service.

Should I rebuild that /etc/init.d/nifi service file using the command (as root, once again) ./nifi.sh install? I ask because this service script for nifi looks too small compared to what I am used to seeing:

the small /etc/init.d/nifi file:

NIFI_HOME=/local/opt/nifi/nifi-1.3.0
bin_dir=${NIFI_HOME}/bin
nifi_executable=${bin_dir}/nifi.sh

${nifi_executable} "$@"


Or is this what you expect to see with NiFi 1.3.0?

Thanks again. Will follow up later. -Jim

On Mon, Jun 12, 2017 at 9:23 PM, Aldrin Piri <[hidden email]> wrote:
Hi James!

NiFi 1.0+ explicitly requires Java 8. 

As far as service installation, it is likely needed to be done as root for touching those parts of the system. 

Would also suggest using the script to install the service.

Let us know if you hit hurdles after getting JRE 8 installed. 

Aldrin Piri 
Sent from my mobile device. 

On Jun 12, 2017, at 17:46, James McMahon <[hidden email]> wrote:

Good evening. I downloaded NiFi 1.3.0 to a linux EC2 instance in AWS I recently created. A uname -or tells me the version of Linux I am running: 4.9.20-11.31.amzn1.x86_64 GNU/Linux


I tried to establish nifi as a service. I was the root user - not the nifi user - I changed to the bin directory of my nifi installation and ran
./nifi.sh install
I got this small /etc/init.d/nifi file:

NIFI_HOME=/local/opt/nifi/nifi-1.3.0
bin_dir=${NIFI_HOME}/bin
nifi_executable=${bin_dir}/nifi.sh

${nifi_executable} "$@"

I then executed 
service nifi start
I expected the service to start owned by user nifi, because in my bootstrap.conf file I set
run.as=nifi

It never started. I got this error:
[root@ip-10-0-0-21 init.d]# service nifi start
nifi.sh: JAVA_HOME not set; results may vary

Java home:
NiFi home: /local/opt/nifi/nifi-1.3.0

Bootstrap Config File: /local/opt/nifi/nifi-1.3.0/conf/bootstrap.conf

Exception in thread "main" java.lang.UnsupportedClassVersionError: org/apache/nifi/bootstrap/RunNiFi : Unsupported major.minor version 52.0
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:803)
        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
        at java.net.URLClassLoader.defineClass(URLClassLoader.java:442)
        at java.net.URLClassLoader.access$100(URLClassLoader.java:64)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:354)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:348)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:347)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
        at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:482)

I tried to determine what version of java, and this is what I learned:
[root@ip-10-0-0-21 init.d]# which java
/usr/bin/java
[root@ip-10-0-0-21 init.d]# ls -tl /usr/bin/java
lrwxrwxrwx 1 root root 22 Apr 17 07:58 /usr/bin/java -> /etc/alternatives/java
[root@ip-10-0-0-21 init.d]# ls -tl /etc/alternatives/java
lrwxrwxrwx 1 root root 46 Apr 17 07:58 /etc/alternatives/java -> /usr/lib/jvm/jre-1.7.0-openjdk.x86_64/bin/java
[root@ip-10-0-0-21 init.d]# uname -or
4.9.20-11.31.amzn1.x86_64 GNU/Linux
[root@ip-10-0-0-21 init.d]#

As user nifi, I try to determine my java version but it cannot find javac:
[nifi@ip-10-0-0-21 conf]$ javac -version
bash: javac: command not found

I started an EC2 that is supposed to have java on it but evidently it must not.

So my questions:
* has anyone conquered this problem, and if so can you offer any guidance?
* Does that jre-1.7.0 mean I am doomed from the start here because NiFi 1.3.0 requires java 8?
* should I run the run/sh install to set up as a service as root?

Thank you in advance for any help.-Jim