Support Questions

Find answers, ask questions, and share your expertise

Oozie-- java: command not found - shell action

avatar
Expert Contributor

I am running a java program from a shell script through Oozie and I get the below error

java: command not found

When I run the shell script from the edge node I do not find any issues and the java class runs without any error and I get the desired output also. However it is the oozie job that fails to run the java command.

All other actions in oozie are executed porperly but when it encounters the java line, it throws the afore said error. I understand that all the nodes in the Hadoop cluster will have Java installed, then why do I get this error? Below is the java command that I have in my shell script

...
...    
java -cp $LOCAL_DIR/libs/integration-tools.jar com.audit.reporting.GenerateExcelReport $LOCAL_DIR/input.txt $LOCAL_DIR/
... 

Please provide your thoughts.

1 ACCEPTED SOLUTION

avatar
Expert Contributor

"Issue Fixed"

I talked with my DevOps later and found that the classpath for Java was not set in few datanodes in the Cluster. This was stopping the shell action to invoke the JVM at those datanodes. After fixing the Classpath, the job ran successfully

View solution in original post

5 REPLIES 5

avatar
Master Mentor

@Alex Raj

In your shell script try adding the following entries to tell where the JAVA is present as following:

export JAVA_HOME=/PATH/To/jdk1.8.0_67
$JAVA_HOME/bin/java -cp $LOCAL_DIR/libs/integration-tools.jar com.audit.reporting.GenerateExcelReport $LOCAL_DIR/input.txt $LOCAL_DIR/

.

avatar
Expert Contributor

I got the below error after those changes mentioned by you.

          <a href="http://10.241.1.164:8888/filebrowser/view=/opt/cloudera/parcels/CDH-5.5.2-1.cdh5.5.2.p0.4/lib/hadoop-hdfs/bin/hdfs%3A">/opt/cloudera/parcels/CDH-5.5.2-1.cdh5.5.2.p0.4/bin/../lib/hadoop-hdfs/bin/hdfs:</a> line 309: <a href="http://10.241.1.164:8888/filebrowser/view=/usr/java/jdk1.7.0_67/bin/java%3A">/usr/java/jdk1.7.0_67/bin/java:</a> No such file or directory
/opt/cloudera/parcels/CDH-5.5.2-1.cdh5.5.2.p0.4/bin/../lib/hadoop-hdfs/bin/hdfs: line 309: exec: <a href="http://10.241.1.164:8888/filebrowser/view=/usr/java/jdk1.7.0_67/bin/java%3A">/usr/java/jdk1.7.0_67/bin/java:</a> cannot execute: No such file or directory
./test.sh: line 30: <a href="http://10.241.1.164:8888/filebrowser/view=/usr/java/jdk1.7.0_67/bin/java%3A">/usr/java/jdk1.7.0_67/bin/java:</a> No such file or directory

avatar
Master Mentor

@Alex Raj

Looks like in your JAVA Path you have added some extra character "%3A" which means ":"

/usr/java/jdk1.7.0_67/bin/java%3A

.

Please check where it was added and then remove the extra ":" from "

/usr/java/jdk1.7.0_67/bin/java:

avatar
Expert Contributor

That is carriage return from the log while copying the content.

I have created the JAVA_PATH accordingly.

avatar
Expert Contributor

"Issue Fixed"

I talked with my DevOps later and found that the classpath for Java was not set in few datanodes in the Cluster. This was stopping the shell action to invoke the JVM at those datanodes. After fixing the Classpath, the job ran successfully