Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

Oozie-- java: command not found - shell action

Solved Go to solution
Highlighted

Oozie-- java: command not found - shell action

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

Accepted Solutions

Re: Oozie-- java: command not found - shell action

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

5 REPLIES 5

Re: Oozie-- java: command not found - shell action

Super 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/

.

Re: Oozie-- java: command not found - shell action

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

Re: Oozie-- java: command not found - shell action

Super 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:

Re: Oozie-- java: command not found - shell action

Expert Contributor

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

I have created the JAVA_PATH accordingly.

Re: Oozie-- java: command not found - shell action

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

Don't have an account?
Coming from Hortonworks? Activate your account here