title: Yarn application has already ended! It might have been killed or unable to launch application master
body: <p>My <code>spark-shell --master yarn</code> came up with this error when I started it.
  Can you help me out in understanding the reason of this container failure? There are no errors/info present in application logs.</p>
  
  <pre><code>[root@Master ~]# spark-shell --master yarn-client
  SLF4J: Class path contains multiple SLF4J bindings.
  SLF4J: Found binding in [jar:file:/usr/spark-1.6.1-bin-2.6.0-cdh5.7.0/lib/spark-assembly-1.6.1-hadoop2.6.0-cdh5.7.0.jar!/org/slf4j/impl/StaticLoggerBinder.class]
  SLF4J: Found binding in [jar:file:/usr/hadoop/share/hadoop/common/lib/slf4j-log4j12-1.7.5.jar!/org/slf4j/impl/StaticLoggerBinder.class]
  SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
  SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory]
  18/04/23 00:40:03 INFO spark.SecurityManager: Changing view acls to: root
  18/04/23 00:40:03 INFO spark.SecurityManager: Changing modify acls to: root
  18/04/23 00:40:03 INFO spark.SecurityManager: SecurityManager: authentication disabled; ui acls disabled; users with view permissions: Set(root); users with modify permissions: Set(root)
  18/04/23 00:40:04 INFO spark.HttpServer: Starting HTTP Server
  18/04/23 00:40:04 INFO server.Server: jetty-8.y.z-SNAPSHOT
  18/04/23 00:40:04 INFO server.AbstractConnector: Started SocketConnector@0.0.0.0:46698
  18/04/23 00:40:04 INFO util.Utils: Successfully started service 'HTTP class server' on port 46698.
  Welcome to
        ____              __
       / __/__  ___ _____/ /__
      _\ \/ _ \/ _ `/ __/  '_/
     /___/ .__/\_,_/_/ /_/\_\   version 1.6.1
        /_/
  
  Using Scala version 2.10.5 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_151)
  Type in expressions to have them evaluated.
  Type :help for more information.
  18/04/23 00:40:06 INFO spark.SparkContext: Running Spark version 1.6.1
  18/04/23 00:40:06 INFO spark.SecurityManager: Changing view acls to: root
  18/04/23 00:40:06 INFO spark.SecurityManager: Changing modify acls to: root
  18/04/23 00:40:06 INFO spark.SecurityManager: SecurityManager: authentication disabled; ui acls disabled; users with view permissions: Set(root); users with modify permissions: Set(root)
  18/04/23 00:40:06 INFO util.Utils: Successfully started service 'sparkDriver' on port 56838.
  18/04/23 00:40:06 INFO slf4j.Slf4jLogger: Slf4jLogger started
  18/04/23 00:40:06 INFO Remoting: Starting remoting
  18/04/23 00:40:07 INFO Remoting: Remoting started; listening on addresses :[akka.tcp://sparkDriverActorSystem@127.0.0.1:52497]
  18/04/23 00:40:07 INFO util.Utils: Successfully started service 'sparkDriverActorSystem' on port 52497.
  18/04/23 00:40:07 INFO spark.SparkEnv: Registering MapOutputTracker
  18/04/23 00:40:07 INFO spark.SparkEnv: Registering BlockManagerMaster
  18/04/23 00:40:07 INFO storage.DiskBlockManager: Created local directory at /tmp/blockmgr-3d448992-8dce-467c-9146-c3382d586e6b
  18/04/23 00:40:07 INFO storage.MemoryStore: MemoryStore started with capacity 2.7 GB
  18/04/23 00:40:07 INFO spark.SparkEnv: Registering OutputCommitCoordinator
  18/04/23 00:40:09 INFO server.Server: jetty-8.y.z-SNAPSHOT
  18/04/23 00:40:09 INFO server.AbstractConnector: Started SelectChannelConnector@0.0.0.0:4040
  18/04/23 00:40:09 INFO util.Utils: Successfully started service 'SparkUI' on port 4040.
  18/04/23 00:40:09 INFO ui.SparkUI: Started SparkUI at http://127.0.0.1:4040
  18/04/23 00:40:09 INFO client.RMProxy: Connecting to ResourceManager at master/192.168.1.254:8032
  18/04/23 00:40:09 INFO yarn.Client: Requesting a new application from cluster with 1 NodeManagers
  18/04/23 00:40:09 INFO yarn.Client: Verifying our application has not requested more than the maximum memory capability of the cluster (2048 MB per container)
  18/04/23 00:40:09 INFO yarn.Client: Will allocate AM container, with 896 MB memory including 384 MB overhead
  18/04/23 00:40:09 INFO yarn.Client: Setting up container launch context for our AM
  18/04/23 00:40:09 INFO yarn.Client: Setting up the launch environment for our AM container
  18/04/23 00:40:09 WARN yarn.Client: SPARK_JAR detected in the system environment. This variable has been deprecated in favor of the spark.yarn.jar configuration variable.
  18/04/23 00:40:09 INFO yarn.Client: Preparing resources for our AM container
  18/04/23 00:40:10 WARN yarn.Client: SPARK_JAR detected in the system environment. This variable has been deprecated in favor of the spark.yarn.jar configuration variable.
  18/04/23 00:40:10 INFO yarn.Client: Uploading resource file:/usr/spark-1.6.1-bin-2.6.0-cdh5.7.0/lib/spark-assembly-1.6.1-hadoop2.6.0-cdh5.7.0.jar -&gt; hdfs://master:9000/user/root/.sparkStaging/application_1524413274967_0004/spark-assembly-1.6.1-hadoop2.6.0-cdh5.7.0.jar
  18/04/23 00:40:11 INFO yarn.Client: Uploading resource file:/tmp/spark-0e77eb17-395d-425b-bda7-a8b3e7f35ee1/__spark_conf__477163183947757155.zip -&gt; hdfs://master:9000/user/root/.sparkStaging/application_1524413274967_0004/__spark_conf__477163183947757155.zip
  18/04/23 00:40:11 INFO spark.SecurityManager: Changing view acls to: root
  18/04/23 00:40:11 INFO spark.SecurityManager: Changing modify acls to: root
  18/04/23 00:40:11 INFO spark.SecurityManager: SecurityManager: authentication disabled; ui acls disabled; users with view permissions: Set(root); users with modify permissions: Set(root)
  18/04/23 00:40:11 INFO yarn.Client: Submitting application 4 to ResourceManager
  18/04/23 00:40:11 INFO impl.YarnClientImpl: Submitted application application_1524413274967_0004
  18/04/23 00:40:12 INFO yarn.Client: Application report for application_1524413274967_0004 (state: ACCEPTED)
  18/04/23 00:40:12 INFO yarn.Client: 
       client token: N/A
       diagnostics: N/A
       ApplicationMaster host: N/A
       ApplicationMaster RPC port: -1
       queue: root.root
       start time: 1524415211241
       final status: UNDEFINED
       tracking URL: http://Master:8088/proxy/application_1524413274967_0004/
       user: root
  18/04/23 00:40:13 INFO yarn.Client: Application report for application_1524413274967_0004 (state: ACCEPTED)
  18/04/23 00:40:14 INFO yarn.Client: Application report for application_1524413274967_0004 (state: ACCEPTED)
  18/04/23 00:40:15 INFO yarn.Client: Application report for application_1524413274967_0004 (state: FAILED)
  18/04/23 00:40:15 INFO yarn.Client: 
       client token: N/A
       diagnostics: Application application_1524413274967_0004 failed 2 times due to AM Container for appattempt_1524413274967_0004_000002 exited with  exitCode: -1000
  For more detailed output, check application tracking page:http://Master:8088/proxy/application_1524413274967_0004/Then, click on links to logs of each attempt.
  Diagnostics: Wrong FS: file://usr/hadoop/tmp/nm-local-dir, expected: file:///
  Failing this attempt. Failing the application.
       ApplicationMaster host: N/A
       ApplicationMaster RPC port: -1
       queue: root.root
       start time: 1524415211241
       final status: FAILED
       tracking URL: http://Master:8088/cluster/app/application_1524413274967_0004
       user: root
  18/04/23 00:40:15 INFO yarn.Client: Deleting staging directory .sparkStaging/application_1524413274967_0004
  18/04/23 00:40:15 ERROR spark.SparkContext: Error initializing SparkContext.
  org.apache.spark.SparkException: Yarn application has already ended! It might have been killed or unable to launch application master.
      at org.apache.spark.scheduler.cluster.YarnClientSchedulerBackend.waitForApplication(YarnClientSchedulerBackend.scala:124)
      at org.apache.spark.scheduler.cluster.YarnClientSchedulerBackend.start(YarnClientSchedulerBackend.scala:64)
      at org.apache.spark.scheduler.TaskSchedulerImpl.start(TaskSchedulerImpl.scala:144)
      at org.apache.spark.SparkContext.&lt;init&gt;(SparkContext.scala:530)
      at org.apache.spark.repl.SparkILoop.createSparkContext(SparkILoop.scala:1017)
      at $line3.$read$$iwC$$iwC.&lt;init&gt;(&lt;console&gt;:15)
      at $line3.$read$$iwC.&lt;init&gt;(&lt;console&gt;:24)
      at $line3.$read.&lt;init&gt;(&lt;console&gt;:26)
      at $line3.$read$.&lt;init&gt;(&lt;console&gt;:30)
      at $line3.$read$.&lt;clinit&gt;(&lt;console&gt;)
      at $line3.$eval$.&lt;init&gt;(&lt;console&gt;:7)
      at $line3.$eval$.&lt;clinit&gt;(&lt;console&gt;)
      at $line3.$eval.$print(&lt;console&gt;)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:498)
      at org.apache.spark.repl.SparkIMain$ReadEvalPrint.call(SparkIMain.scala:1065)
      at org.apache.spark.repl.SparkIMain$Request.loadAndRun(SparkIMain.scala:1346)
      at org.apache.spark.repl.SparkIMain.loadAndRunReq$1(SparkIMain.scala:840)
      at org.apache.spark.repl.SparkIMain.interpret(SparkIMain.scala:871)
      at org.apache.spark.repl.SparkIMain.interpret(SparkIMain.scala:819)
      at org.apache.spark.repl.SparkILoop.reallyInterpret$1(SparkILoop.scala:857)
      at org.apache.spark.repl.SparkILoop.interpretStartingWith(SparkILoop.scala:902)
      at org.apache.spark.repl.SparkILoop.command(SparkILoop.scala:814)
      at org.apache.spark.repl.SparkILoopInit$$anonfun$initializeSpark$1.apply(SparkILoopInit.scala:125)
      at org.apache.spark.repl.SparkILoopInit$$anonfun$initializeSpark$1.apply(SparkILoopInit.scala:124)
      at org.apache.spark.repl.SparkIMain.beQuietDuring(SparkIMain.scala:324)
      at org.apache.spark.repl.SparkILoopInit$class.initializeSpark(SparkILoopInit.scala:124)
      at org.apache.spark.repl.SparkILoop.initializeSpark(SparkILoop.scala:64)
      at org.apache.spark.repl.SparkILoop$$anonfun$org$apache$spark$repl$SparkILoop$$process$1$$anonfun$apply$mcZ$sp$5.apply$mcV$sp(SparkILoop.scala:974)
      at org.apache.spark.repl.SparkILoopInit$class.runThunks(SparkILoopInit.scala:159)
      at org.apache.spark.repl.SparkILoop.runThunks(SparkILoop.scala:64)
      at org.apache.spark.repl.SparkILoopInit$class.postInitialization(SparkILoopInit.scala:108)
      at org.apache.spark.repl.SparkILoop.postInitialization(SparkILoop.scala:64)
      at org.apache.spark.repl.SparkILoop$$anonfun$org$apache$spark$repl$SparkILoop$$process$1.apply$mcZ$sp(SparkILoop.scala:991)
      at org.apache.spark.repl.SparkILoop$$anonfun$org$apache$spark$repl$SparkILoop$$process$1.apply(SparkILoop.scala:945)
      at org.apache.spark.repl.SparkILoop$$anonfun$org$apache$spark$repl$SparkILoop$$process$1.apply(SparkILoop.scala:945)
      at scala.tools.nsc.util.ScalaClassLoader$.savingContextLoader(ScalaClassLoader.scala:135)
      at org.apache.spark.repl.SparkILoop.org$apache$spark$repl$SparkILoop$$process(SparkILoop.scala:945)
      at org.apache.spark.repl.SparkILoop.process(SparkILoop.scala:1059)
      at org.apache.spark.repl.Main$.main(Main.scala:31)
      at org.apache.spark.repl.Main.main(Main.scala)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:498)
      at org.apache.spark.deploy.SparkSubmit$.org$apache$spark$deploy$SparkSubmit$$runMain(SparkSubmit.scala:731)
      at org.apache.spark.deploy.SparkSubmit$.doRunMain$1(SparkSubmit.scala:181)
      at org.apache.spark.deploy.SparkSubmit$.submit(SparkSubmit.scala:206)
      at org.apache.spark.deploy.SparkSubmit$.main(SparkSubmit.scala:121)
      at org.apache.spark.deploy.SparkSubmit.main(SparkSubmit.scala)
  18/04/23 00:40:15 INFO handler.ContextHandler: stopped o.s.j.s.ServletContextHandler{/stages/stage/kill,null}
  18/04/23 00:40:15 INFO handler.ContextHandler: stopped o.s.j.s.ServletContextHandler{/api,null}
  18/04/23 00:40:15 INFO handler.ContextHandler: stopped o.s.j.s.ServletContextHandler{/,null}
  18/04/23 00:40:15 INFO handler.ContextHandler: stopped o.s.j.s.ServletContextHandler{/static,null}
  18/04/23 00:40:15 INFO handler.ContextHandler: stopped o.s.j.s.ServletContextHandler{/executors/threadDump/json,null}
  18/04/23 00:40:15 INFO handler.ContextHandler: stopped o.s.j.s.ServletContextHandler{/executors/threadDump,null}
  18/04/23 00:40:15 INFO handler.ContextHandler: stopped o.s.j.s.ServletContextHandler{/executors/json,null}
  18/04/23 00:40:15 INFO handler.ContextHandler: stopped o.s.j.s.ServletContextHandler{/executors,null}
  18/04/23 00:40:15 INFO handler.ContextHandler: stopped o.s.j.s.ServletContextHandler{/environment/json,null}
  18/04/23 00:40:15 INFO handler.ContextHandler: stopped o.s.j.s.ServletContextHandler{/environment,null}
  18/04/23 00:40:15 INFO handler.ContextHandler: stopped o.s.j.s.ServletContextHandler{/storage/rdd/json,null}
  18/04/23 00:40:15 INFO handler.ContextHandler: stopped o.s.j.s.ServletContextHandler{/storage/rdd,null}
  18/04/23 00:40:15 INFO handler.ContextHandler: stopped o.s.j.s.ServletContextHandler{/storage/json,null}
  18/04/23 00:40:15 INFO handler.ContextHandler: stopped o.s.j.s.ServletContextHandler{/storage,null}
  18/04/23 00:40:15 INFO handler.ContextHandler: stopped o.s.j.s.ServletContextHandler{/stages/pool/json,null}
  18/04/23 00:40:15 INFO handler.ContextHandler: stopped o.s.j.s.ServletContextHandler{/stages/pool,null}
  18/04/23 00:40:15 INFO handler.ContextHandler: stopped o.s.j.s.ServletContextHandler{/stages/stage/json,null}
  18/04/23 00:40:15 INFO handler.ContextHandler: stopped o.s.j.s.ServletContextHandler{/stages/stage,null}
  18/04/23 00:40:15 INFO handler.ContextHandler: stopped o.s.j.s.ServletContextHandler{/stages/json,null}
  18/04/23 00:40:15 INFO handler.ContextHandler: stopped o.s.j.s.ServletContextHandler{/stages,null}
  18/04/23 00:40:15 INFO handler.ContextHandler: stopped o.s.j.s.ServletContextHandler{/jobs/job/json,null}
  18/04/23 00:40:15 INFO handler.ContextHandler: stopped o.s.j.s.ServletContextHandler{/jobs/job,null}
  18/04/23 00:40:15 INFO handler.ContextHandler: stopped o.s.j.s.ServletContextHandler{/jobs/json,null}
  18/04/23 00:40:15 INFO handler.ContextHandler: stopped o.s.j.s.ServletContextHandler{/jobs,null}
  18/04/23 00:40:15 INFO ui.SparkUI: Stopped Spark web UI at http://127.0.0.1:4040
  18/04/23 00:40:15 INFO cluster.YarnClientSchedulerBackend: Shutting down all executors
  18/04/23 00:40:15 INFO cluster.YarnClientSchedulerBackend: Asking each executor to shut down
  18/04/23 00:40:15 INFO cluster.YarnClientSchedulerBackend: Stopped
  18/04/23 00:40:15 INFO spark.MapOutputTrackerMasterEndpoint: MapOutputTrackerMasterEndpoint stopped!
  18/04/23 00:40:15 INFO storage.MemoryStore: MemoryStore cleared
  18/04/23 00:40:15 INFO storage.BlockManager: BlockManager stopped
  18/04/23 00:40:15 INFO storage.BlockManagerMaster: BlockManagerMaster stopped
  18/04/23 00:40:15 WARN metrics.MetricsSystem: Stopping a MetricsSystem that is not running
  18/04/23 00:40:15 INFO scheduler.OutputCommitCoordinator$OutputCommitCoordinatorEndpoint: OutputCommitCoordinator stopped!
  18/04/23 00:40:15 INFO remote.RemoteActorRefProvider$RemotingTerminator: Shutting down remote daemon.
  18/04/23 00:40:15 INFO spark.SparkContext: Successfully stopped SparkContext
  18/04/23 00:40:15 INFO remote.RemoteActorRefProvider$RemotingTerminator: Remote daemon shut down; proceeding with flushing remote transports.
  18/04/23 00:40:15 INFO remote.RemoteActorRefProvider$RemotingTerminator: Remoting shut down.
  org.apache.spark.SparkException: Yarn application has already ended! It might have been killed or unable to launch application master.
      at org.apache.spark.scheduler.cluster.YarnClientSchedulerBackend.waitForApplication(YarnClientSchedulerBackend.scala:124)
      at org.apache.spark.scheduler.cluster.YarnClientSchedulerBackend.start(YarnClientSchedulerBackend.scala:64)
      at org.apache.spark.scheduler.TaskSchedulerImpl.start(TaskSchedulerImpl.scala:144)
      at org.apache.spark.SparkContext.&lt;init&gt;(SparkContext.scala:530)
      at org.apache.spark.repl.SparkILoop.createSparkContext(SparkILoop.scala:1017)
      at $iwC$$iwC.&lt;init&gt;(&lt;console&gt;:15)
      at $iwC.&lt;init&gt;(&lt;console&gt;:24)
      at &lt;init&gt;(&lt;console&gt;:26)
      at .&lt;init&gt;(&lt;console&gt;:30)
      at .&lt;clinit&gt;(&lt;console&gt;)
      at .&lt;init&gt;(&lt;console&gt;:7)
      at .&lt;clinit&gt;(&lt;console&gt;)
      at $print(&lt;console&gt;)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:498)
      at org.apache.spark.repl.SparkIMain$ReadEvalPrint.call(SparkIMain.scala:1065)
      at org.apache.spark.repl.SparkIMain$Request.loadAndRun(SparkIMain.scala:1346)
      at org.apache.spark.repl.SparkIMain.loadAndRunReq$1(SparkIMain.scala:840)
      at org.apache.spark.repl.SparkIMain.interpret(SparkIMain.scala:871)
      at org.apache.spark.repl.SparkIMain.interpret(SparkIMain.scala:819)
      at org.apache.spark.repl.SparkILoop.reallyInterpret$1(SparkILoop.scala:857)
      at org.apache.spark.repl.SparkILoop.interpretStartingWith(SparkILoop.scala:902)
      at org.apache.spark.repl.SparkILoop.command(SparkILoop.scala:814)
      at org.apache.spark.repl.SparkILoopInit$$anonfun$initializeSpark$1.apply(SparkILoopInit.scala:125)
      at org.apache.spark.repl.SparkILoopInit$$anonfun$initializeSpark$1.apply(SparkILoopInit.scala:124)
      at org.apache.spark.repl.SparkIMain.beQuietDuring(SparkIMain.scala:324)
      at org.apache.spark.repl.SparkILoopInit$class.initializeSpark(SparkILoopInit.scala:124)
      at org.apache.spark.repl.SparkILoop.initializeSpark(SparkILoop.scala:64)
      at org.apache.spark.repl.SparkILoop$$anonfun$org$apache$spark$repl$SparkILoop$$process$1$$anonfun$apply$mcZ$sp$5.apply$mcV$sp(SparkILoop.scala:974)
      at org.apache.spark.repl.SparkILoopInit$class.runThunks(SparkILoopInit.scala:159)
      at org.apache.spark.repl.SparkILoop.runThunks(SparkILoop.scala:64)
      at org.apache.spark.repl.SparkILoopInit$class.postInitialization(SparkILoopInit.scala:108)
      at org.apache.spark.repl.SparkILoop.postInitialization(SparkILoop.scala:64)
      at org.apache.spark.repl.SparkILoop$$anonfun$org$apache$spark$repl$SparkILoop$$process$1.apply$mcZ$sp(SparkILoop.scala:991)
      at org.apache.spark.repl.SparkILoop$$anonfun$org$apache$spark$repl$SparkILoop$$process$1.apply(SparkILoop.scala:945)
      at org.apache.spark.repl.SparkILoop$$anonfun$org$apache$spark$repl$SparkILoop$$process$1.apply(SparkILoop.scala:945)
      at scala.tools.nsc.util.ScalaClassLoader$.savingContextLoader(ScalaClassLoader.scala:135)
      at org.apache.spark.repl.SparkILoop.org$apache$spark$repl$SparkILoop$$process(SparkILoop.scala:945)
      at org.apache.spark.repl.SparkILoop.process(SparkILoop.scala:1059)
      at org.apache.spark.repl.Main$.main(Main.scala:31)
      at org.apache.spark.repl.Main.main(Main.scala)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:498)
      at org.apache.spark.deploy.SparkSubmit$.org$apache$spark$deploy$SparkSubmit$$runMain(SparkSubmit.scala:731)
      at org.apache.spark.deploy.SparkSubmit$.doRunMain$1(SparkSubmit.scala:181)
      at org.apache.spark.deploy.SparkSubmit$.submit(SparkSubmit.scala:206)
      at org.apache.spark.deploy.SparkSubmit$.main(SparkSubmit.scala:121)
      at org.apache.spark.deploy.SparkSubmit.main(SparkSubmit.scala)
  
  java.lang.NullPointerException
      at org.apache.spark.sql.SQLContext$.createListenerAndUI(SQLContext.scala:1367)
      at org.apache.spark.sql.hive.HiveContext.&lt;init&gt;(HiveContext.scala:101)
      at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
      at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
      at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
      at org.apache.spark.repl.SparkILoop.createSQLContext(SparkILoop.scala:1028)
      at $iwC$$iwC.&lt;init&gt;(&lt;console&gt;:15)
      at $iwC.&lt;init&gt;(&lt;console&gt;:24)
      at &lt;init&gt;(&lt;console&gt;:26)
      at .&lt;init&gt;(&lt;console&gt;:30)
      at .&lt;clinit&gt;(&lt;console&gt;)
      at .&lt;init&gt;(&lt;console&gt;:7)
      at .&lt;clinit&gt;(&lt;console&gt;)
      at $print(&lt;console&gt;)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:498)
      at org.apache.spark.repl.SparkIMain$ReadEvalPrint.call(SparkIMain.scala:1065)
      at org.apache.spark.repl.SparkIMain$Request.loadAndRun(SparkIMain.scala:1346)
      at org.apache.spark.repl.SparkIMain.loadAndRunReq$1(SparkIMain.scala:840)
      at org.apache.spark.repl.SparkIMain.interpret(SparkIMain.scala:871)
      at org.apache.spark.repl.SparkIMain.interpret(SparkIMain.scala:819)
      at org.apache.spark.repl.SparkILoop.reallyInterpret$1(SparkILoop.scala:857)
      at org.apache.spark.repl.SparkILoop.interpretStartingWith(SparkILoop.scala:902)
      at org.apache.spark.repl.SparkILoop.command(SparkILoop.scala:814)
      at org.apache.spark.repl.SparkILoopInit$$anonfun$initializeSpark$1.apply(SparkILoopInit.scala:132)
      at org.apache.spark.repl.SparkILoopInit$$anonfun$initializeSpark$1.apply(SparkILoopInit.scala:124)
      at org.apache.spark.repl.SparkIMain.beQuietDuring(SparkIMain.scala:324)
      at org.apache.spark.repl.SparkILoopInit$class.initializeSpark(SparkILoopInit.scala:124)
      at org.apache.spark.repl.SparkILoop.initializeSpark(SparkILoop.scala:64)
      at org.apache.spark.repl.SparkILoop$$anonfun$org$apache$spark$repl$SparkILoop$$process$1$$anonfun$apply$mcZ$sp$5.apply$mcV$sp(SparkILoop.scala:974)
      at org.apache.spark.repl.SparkILoopInit$class.runThunks(SparkILoopInit.scala:159)
      at org.apache.spark.repl.SparkILoop.runThunks(SparkILoop.scala:64)
      at org.apache.spark.repl.SparkILoopInit$class.postInitialization(SparkILoopInit.scala:108)
      at org.apache.spark.repl.SparkILoop.postInitialization(SparkILoop.scala:64)
      at org.apache.spark.repl.SparkILoop$$anonfun$org$apache$spark$repl$SparkILoop$$process$1.apply$mcZ$sp(SparkILoop.scala:991)
      at org.apache.spark.repl.SparkILoop$$anonfun$org$apache$spark$repl$SparkILoop$$process$1.apply(SparkILoop.scala:945)
      at org.apache.spark.repl.SparkILoop$$anonfun$org$apache$spark$repl$SparkILoop$$process$1.apply(SparkILoop.scala:945)
      at scala.tools.nsc.util.ScalaClassLoader$.savingContextLoader(ScalaClassLoader.scala:135)
      at org.apache.spark.repl.SparkILoop.org$apache$spark$repl$SparkILoop$$process(SparkILoop.scala:945)
      at org.apache.spark.repl.SparkILoop.process(SparkILoop.scala:1059)
      at org.apache.spark.repl.Main$.main(Main.scala:31)
      at org.apache.spark.repl.Main.main(Main.scala)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:498)
      at org.apache.spark.deploy.SparkSubmit$.org$apache$spark$deploy$SparkSubmit$$runMain(SparkSubmit.scala:731)
      at org.apache.spark.deploy.SparkSubmit$.doRunMain$1(SparkSubmit.scala:181)
      at org.apache.spark.deploy.SparkSubmit$.submit(SparkSubmit.scala:206)
      at org.apache.spark.deploy.SparkSubmit$.main(SparkSubmit.scala:121)
      at org.apache.spark.deploy.SparkSubmit.main(SparkSubmit.scala)
  
  &lt;console&gt;:16: error: not found: value sqlContext
           import sqlContext.implicits._
                  ^
  &lt;console&gt;:16: error: not found: value sqlContext
           import sqlContext.sql
                  ^
  
  scala&gt; 
  </code></pre>