Created on 08-10-2017 03:35 PM - edited 08-17-2019 08:20 PM
Hello,
I am using NIFI in HDP sandbox to execute a java jar. This jar contains a simple Hbase which creates a table based on argument supplied from NIFI instance.
I used ExecuteStreamComand processor to call this jar with properties as said shown
but it throws error as follows:
I tried again but by changing the Working Directory to:
root/IdeaProjects/mavenhbasetest/target/
I now get the following error :
Fyi, I tried testing the jar in shell and it works fine.
Could someone provide me help on where am I going wrong?
Thanks and regards,
Jasim
Created 08-11-2017 03:30 PM
It's easiest to run your commands in a shell script.
What I do is create a shell script, make sure it has all the permissions you need and set any CLASSPATH, JAVA_HOME and other environment variables.
Then I just call it like
/opt/mydir/myshell.sh
This is 777 and will call my java via java -jar ...
Build a jar and run it that way.
Or wrap it in a custom processor.
https://community.hortonworks.com/articles/73811/trigger-sonicpi-music-via-apache-nifi.html
Created 08-10-2017 04:14 PM
Is NiFi running as root? Perhaps it does not have the permission to read the JAR file. You could try copying the JAR file to /tmp/ and reference it there.
Created on 08-11-2017 03:23 PM - edited 08-17-2019 08:19 PM
@Josh Elser I did make change as you said and also added nifi in sudoers as root. But, now I am getting JNI Error:
Tried even after chown as nifi:nifi to folder where java is stored.
But I still get the sam JNI error.
Where am I going wrong?
Thanks
Created 08-11-2017 03:39 PM
Please read the error message. The HBase client has a number of dependencies that it requires to function. You have not included them on the classpath of your application.
Please use the output of `hbase classpath` to see what all is required.
Created 08-11-2017 03:30 PM
It's easiest to run your commands in a shell script.
What I do is create a shell script, make sure it has all the permissions you need and set any CLASSPATH, JAVA_HOME and other environment variables.
Then I just call it like
/opt/mydir/myshell.sh
This is 777 and will call my java via java -jar ...
Build a jar and run it that way.
Or wrap it in a custom processor.
https://community.hortonworks.com/articles/73811/trigger-sonicpi-music-via-apache-nifi.html
Created 12-28-2018 01:36 PM
What helped me was, first copying the file to the $NIFI_HOME/lib folder then giving the full path of the jar file in the ExecuteStreamCommand processor. So the config looked like "-jar; /opt/nifi-1.7.1/lib/mycode.jar". Couple things to ensure is that the jar is owned by the same user that NiFi is running as and the jar could be located anywhere as long as you give full path you should be fine.