完整报错如下:
java.lang.IllegalArgumentException: Can not create a Path from an empty stringat org.apache.hadoop.fs.Path.checkPathArg(Path.java:126)at org.apache.hadoop.fs.Path.<init>(Path.java:134)at org.apache.hadoop.fs.Path.<init>(Path.java:93)at org.apache.spark.deploy.yarn.Client.copyFileToRemote(Client.scala:370)at org.apache.spark.deploy.yarn.Client.org$apache$spark$deploy$yarn$Client$$distribute$1(Client.scala:478)at org.apache.spark.deploy.yarn.Client.prepareLocalResources(Client.scala:517)at org.apache.spark.deploy.yarn.Client.createContainerLaunchContext(Client.scala:869)at org.apache.spark.deploy.yarn.Client.submitApplication(Client.scala:169)at org.apache.spark.scheduler.cluster.YarnClientSchedulerBackend.start(YarnClientSchedulerBackend.scala:57)at org.apache.spark.scheduler.TaskSchedulerImpl.start(TaskSchedulerImpl.scala:164)at org.apache.spark.SparkContext.<init>(SparkContext.scala:500)at org.apache.spark.SparkContext$.getOrCreate(SparkContext.scala:2493)at org.apache.spark.sql.SparkSession$Builder$$anonfun$7.apply(SparkSession.scala:933)at org.apache.spark.sql.SparkSession$Builder$$anonfun$7.apply(SparkSession.scala:924)at scala.Option.getOrElse(Option.scala:121)at org.apache.spark.sql.SparkSession$Builder.getOrCreate(SparkSession.scala:924)at org.apache.spark.repl.Main$.createSparkSession(Main.scala:103)at $line3.$read$$iw$$iw.<init>(<console>:15)at $line3.$read$$iw.<init>(<console>:43)at $line3.$read.<init>(<console>:45)at $line3.$read$.<init>(<console>:49)at $line3.$read$.<clinit>(<console>)at $line3.$eval$.$print$lzycompute(<console>:7)at $line3.$eval$.$print(<console>:6)at $line3.$eval.$print(<console>)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 scala.tools.nsc.interpreter.IMain$ReadEvalPrint.call(IMain.scala:786)at scala.tools.nsc.interpreter.IMain$Request.loadAndRun(IMain.scala:1047)at scala.tools.nsc.interpreter.IMain$WrappedRequest$$anonfun$loadAndRunReq$1.apply(IMain.scala:638)at scala.tools.nsc.interpreter.IMain$WrappedRequest$$anonfun$loadAndRunReq$1.apply(IMain.scala:637)at scala.reflect.internal.util.ScalaClassLoader$class.asContext(ScalaClassLoader.scala:31)at scala.reflect.internal.util.AbstractFileClassLoader.asContext(AbstractFileClassLoader.scala:19)at scala.tools.nsc.interpreter.IMain$WrappedRequest.loadAndRunReq(IMain.scala:637)at scala.tools.nsc.interpreter.IMain.interpret(IMain.scala:569)at scala.tools.nsc.interpreter.IMain.interpret(IMain.scala:565)at scala.tools.nsc.interpreter.ILoop.interpretStartingWith(ILoop.scala:807)at scala.tools.nsc.interpreter.ILoop.command(ILoop.scala:681)at scala.tools.nsc.interpreter.ILoop.processLine(ILoop.scala:395)at org.apache.spark.repl.SparkILoop$$anonfun$initializeSpark$1$$anonfun$apply$mcV$sp$1$$anonfun$apply$mcV$sp$2.apply(SparkILoop.scala:79)at org.apache.spark.repl.SparkILoop$$anonfun$initializeSpark$1$$anonfun$apply$mcV$sp$1$$anonfun$apply$mcV$sp$2.apply(SparkILoop.scala:79)at scala.collection.immutable.List.foreach(List.scala:381)at org.apache.spark.repl.SparkILoop$$anonfun$initializeSpark$1$$anonfun$apply$mcV$sp$1.apply$mcV$sp(SparkILoop.scala:79)at org.apache.spark.repl.SparkILoop$$anonfun$initializeSpark$1$$anonfun$apply$mcV$sp$1.apply(SparkILoop.scala:79)at org.apache.spark.repl.SparkILoop$$anonfun$initializeSpark$1$$anonfun$apply$mcV$sp$1.apply(SparkILoop.scala:79)at scala.tools.nsc.interpreter.ILoop.savingReplayStack(ILoop.scala:91)at org.apache.spark.repl.SparkILoop$$anonfun$initializeSpark$1.apply$mcV$sp(SparkILoop.scala:78)at org.apache.spark.repl.SparkILoop$$anonfun$initializeSpark$1.apply(SparkILoop.scala:78)at org.apache.spark.repl.SparkILoop$$anonfun$initializeSpark$1.apply(SparkILoop.scala:78)at scala.tools.nsc.interpreter.IMain.beQuietDuring(IMain.scala:214)at org.apache.spark.repl.SparkILoop.initializeSpark(SparkILoop.scala:77)at org.apache.spark.repl.SparkILoop.loadFiles(SparkILoop.scala:110)at scala.tools.nsc.interpreter.ILoop$$anonfun$process$1.apply$mcZ$sp(ILoop.scala:920)at scala.tools.nsc.interpreter.ILoop$$anonfun$process$1.apply(ILoop.scala:909)at scala.tools.nsc.interpreter.ILoop$$anonfun$process$1.apply(ILoop.scala:909)at scala.reflect.internal.util.ScalaClassLoader$.savingContextLoader(ScalaClassLoader.scala:97)at scala.tools.nsc.interpreter.ILoop.process(ILoop.scala:909)at org.apache.spark.repl.Main$.doMain(Main.scala:76)at org.apache.spark.repl.Main$.main(Main.scala:56)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.JavaMainApplication.start(SparkApplication.scala:52)at org.apache.spark.deploy.SparkSubmit$.org$apache$spark$deploy$SparkSubmit$$runMain(SparkSubmit.scala:894)at org.apache.spark.deploy.SparkSubmit$.doRunMain$1(SparkSubmit.scala:198)at org.apache.spark.deploy.SparkSubmit$.submit(SparkSubmit.scala:228)at org.apache.spark.deploy.SparkSubmit$.main(SparkSubmit.scala:137)at org.apache.spark.deploy.SparkSubmit.main(SparkSubmit.scala)
2020-05-01 12:05:39 WARN YarnSchedulerBackend$YarnSchedulerEndpoint:66 - Attempted to request executors before the AM has registered!
2020-05-01 12:05:39 WARN MetricsSystem:66 - Stopping a MetricsSystem that is not running
java.lang.IllegalArgumentException: Can not create a Path from an empty stringat org.apache.hadoop.fs.Path.checkPathArg(Path.java:126)at org.apache.hadoop.fs.Path.<init>(Path.java:134)at org.apache.hadoop.fs.Path.<init>(Path.java:93)at org.apache.spark.deploy.yarn.Client.copyFileToRemote(Client.scala:370)at org.apache.spark.deploy.yarn.Client.org$apache$spark$deploy$yarn$Client$$distribute$1(Client.scala:478)at org.apache.spark.deploy.yarn.Client.prepareLocalResources(Client.scala:517)at org.apache.spark.deploy.yarn.Client.createContainerLaunchContext(Client.scala:869)at org.apache.spark.deploy.yarn.Client.submitApplication(Client.scala:169)at org.apache.spark.scheduler.cluster.YarnClientSchedulerBackend.start(YarnClientSchedulerBackend.scala:57)at org.apache.spark.scheduler.TaskSchedulerImpl.start(TaskSchedulerImpl.scala:164)at org.apache.spark.SparkContext.<init>(SparkContext.scala:500)at org.apache.spark.SparkContext$.getOrCreate(SparkContext.scala:2493)at org.apache.spark.sql.SparkSession$Builder$$anonfun$7.apply(SparkSession.scala:933)at org.apache.spark.sql.SparkSession$Builder$$anonfun$7.apply(SparkSession.scala:924)at scala.Option.getOrElse(Option.scala:121)at org.apache.spark.sql.SparkSession$Builder.getOrCreate(SparkSession.scala:924)at org.apache.spark.repl.Main$.createSparkSession(Main.scala:103)... 55 elided
<console>:14: error: not found: value sparkimport spark.implicits._^
<console>:14: error: not found: value sparkimport spark.sql^
解决方案:
spark-defaults.conf中的
spark.yarn.archive hdfs://Desktop:9000/spark/jars/
改成
spark.yarn.jars hdfs://Desktop:9000/spark/jars/
注意:
不要指望上面的解决方案直接copy过去就能解决你的问题,你必须想清楚最近自己改了什么配置,
这个配置可能在你的代码文件中,也可能是某个配置文件。
这种报错的根本原因是:
你的配置中的某个变量的赋值格式或者赋值路径不正确,如果不把最近的改动找出来,那么即使是上stackoverflow找答案也没用。