Home » Java » python – Apache airflow task: java: command not found-Exceptionshub

python – Apache airflow task: java: command not found-Exceptionshub

Posted by: admin February 25, 2020 Leave a comment


I’m running Apache Airflow using Docker. I have installed OpenJDK12 and defined its variables in both of:

export JAVA_HOME=/usr/local/src/jdk-12
export PATH=$PATH:$JAVA_HOME/bin

and I can see Java is running normally especially when I run the Task from the command line :

airflow test ip-importer Download 2020-2-19

where it’s working properly without errors , where the task is for :

Executing java command to run a Jar file

But now when I schedule the task on the webserver UI and when I run it, It doesn’t run properly and gives me this error:

[2020-02-18 00:46:39,941] {{bash_operator.py:126}} INFO –
/tmp/airflowtmpdzijcupu/Download886rmbol: line 1: java: command not

so seems like It’s unable to see the defined paths for Java.

  1. Any hints / ideas for how to solve this issue ?
  2. Another question , In case if the java application has thrown an exception/error , Airflow doesn’t assume it as an error , it assumes it as a succeeded task , Could you advise how to enforce airflow to assume the exception as a real interrupter for the task ?
How to&Answers: