You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@livy.apache.org by Alexander Widak <Al...@atruvia.de> on 2021/09/07 11:48:40 UTC

Bad Request: {"msg":"requirement failed: Session isn't active."}

Hi,

I want to submit a job with an uploaded jar in a programmatic way in java:

       public static void main(String[] args) throws Exception {
             if (args.length != 2) {
                    System.err.println("Usage: PiJob <livy url> <slices>");
                    System.exit(-1);
             }

             LivyClient client = new LivyClientBuilder().setURI(new URI(args[0])).build();

             try {
                    for (String s : System.getProperty("java.class.path").split(File.pathSeparator)) {
                          if (new File(s).getName().startsWith("LIVY-shadow")) {
                                 System.out.println(s);
                                 client.uploadJar(new File(s)).get();
                                 break;
                          }
                    }

                    final int slices = Integer.parseInt(args[1]);
                    double pi = client.submit(new PiJob(slices)).get();

                    System.out.println("Pi is roughly " + pi);
             } finally {
                    client.stop(true);
             }
       }


I'm getting following error:
Caused by: java.io.IOException: Bad Request: {"msg":"requirement failed: Session isn't active."}
        at org.apache.livy.client.http.LivyConnection.sendRequest(LivyConnection.java:229)
        at org.apache.livy.client.http.LivyConnection.post(LivyConnection.java:192)
        at org.apache.livy.client.http.HttpClient$2.call(HttpClient.java:152)
        at org.apache.livy.client.http.HttpClient$2.call(HttpClient.java:149)
        at java.util.concurrent.FutureTask.run(Unknown Source)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(Unknown Source)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
        at java.lang.Thread.run(Unknown Source)


ENV SPARK_VERSION=3.1.2
ENV HADOOP_VERSION=3.2
ENV LIVY_VERSION=0.7.1

conf:
sparkt_livy.1.9ov4a9htatet@fz00dp8h    | [ 'livy.conf' from environment variable ] livy.spark.master = spark://spark:7077
sparkt_livy.1.9ov4a9htatet@fz00dp8h    | [ 'livy.conf' from environment variable ] livy.file.local-dir-whitelist = /opt/jars
sparkt_livy.1.9ov4a9htatet@fz00dp8h    | [   'livy.conf' from 'livy.conf.extra'  ] livy.server.session.timeout-check = true
sparkt_livy.1.9ov4a9htatet@fz00dp8h    | [   'livy.conf' from 'livy.conf.extra'  ] livy.server.session.timeout = 1h
sparkt_livy.1.9ov4a9htatet@fz00dp8h    | [   'livy.conf' from 'livy.conf.extra'  ] livy.server.session.state-retain.sec = 600s
sparkt_livy.1.9ov4a9htatet@fz00dp8h    | [   'livy.conf' from 'livy.conf.extra'  ] livy.spark.deployMode=cluster


What I'm doing wrong?


Alex





Atruvia AG | www.atruvia.de
AG Frankfurt a. M. HRB 102381 | Sitz der Gesellschaft: Frankfurt a. M. | USt-IdNr. DE 143582320
Vorstand: Martin Beyer (Vorstandssprecher), Ulrich Coenen (Vorstandssprecher),
Daniela Bücker, Birgit Frohnhoff, Jörg Staff, Ralf Teufel
Vorsitzender des Aufsichtsrats: Jürgen Brinkmann