0

I am trying to use Livy Batch API to invoke my Spark application.

curl -X POST -d '{"file": "file:///path to file/SampleSparkProject-0.0.2-SNAPSHOT.jar","className": "App","args": ["abc"],"jars": [],"driverMemory": "16g","executorMemory": "8g","executorCores": 2,"numExecutors": 2,"queue": "default","name": "Livy_sample_prog"}' -H "Content-Type: application/json" http://serverip:8998/batches/

POST/batches is failing with the below error:

"Warning: Local jar /path to file/SampleSparkProject-0.0.2-SNAPSHOT.jar does not exist, skipping.",
  "java.lang.ClassNotFoundException: App",

Below are the various things I tried so far

1.Uploaded the jar to HDFS

curl -X POST -d '{"file": "hdfs://path to file/SampleSparkProject-0.0.2-SNAPSHOT.jar","className": "App","args": ["abc"],"jars": [],"driverMemory": "16g","executorMemory": "8g","executorCores": 2,"numExecutors": 2,"queue": "default","name": "Livy_sample_prog"}' -H "Content-Type: application/json" http://serverip:8998/batches/

exception:

"Warning: Skip remote jar hdfs://path to file/SampleSparkProject-0.0.2-SNAPSHOT.jar.",
  "java.lang.ClassNotFoundException: App"

2.added livy.file.local-dir-whitelist as dir which contains the jar file

3.changed file:/// to local:/

I have verified several times the files is present and the path provided in each case is valid.

I am out of options now. Please help to find a solution.

Thanks!!

Chris
  • 23
  • 7

1 Answers1

0

I was able to make this work my giving master as yarn-cluster insted of yarn.

Here is the --data I used

{
    "file": "local:/path/to/file/SampleSparkProject-0.0.2-SNAPSHOT.jar",
    "proxyUser": "nrsapp",
    "className": "App",
    "args": [
        "abc"
    ],
    "name": "Livy_sample_prog",
    "conf": {
        "spark.master": "yarn-cluster",
        "spark.deployMode": "client"
    }
}
Chris
  • 23
  • 7