Ich versuche, spark-Shell
unter Windows 10 auszuführen, aber ich erhalte diesen Fehler jedes Mal, wenn ich es ausführen.
Ich habe sowohl die neuesten als auch die Spark-1.5.0-bin-hadoop2.4-Versionen verwendet.
15/09/22 18:46:24 WARN Connection: BoneCP specified but not present in
CLASSPATH (or one of dependencies)
15/09/22 18:46:24 WARN Connection: BoneCP specified but not present in CLASSPATH (or one of dependencies)
15/09/22 18:46:27 WARN ObjectStore: Version information not found in
metastore. Hive.metastore.schema.verification is not enabled so recording the schema version 1.2.0
15/09/22 18:46:27 WARN ObjectStore: Failed to get database default, returning NoSuchObjectException
15/09/22 18:46:27 WARN : Your hostname, DESKTOP-8JS2RD5 resolves to a loopback/non-reachable address: fe80:0:0:0:0:5efe:c0a8:103%net1, but we couldn't find any external IP address!
Java.lang.RuntimeException: Java.lang.NullPointerException
at org.Apache.hadoop.Hive.ql.session.SessionState.start(SessionState.Java:522)
at org.Apache.spark.sql.Hive.client.ClientWrapper.<init> (ClientWrapper.scala:171)
at org.Apache.spark.sql.Hive.HiveContext.executionHive$lzycompute(HiveContext.scala :163)
at org.Apache.spark.sql.Hive.HiveContext.executionHive(HiveContext.scala:161)
at org.Apache.spark.sql.Hive.HiveContext.<init>(HiveContext.scala:168)
at Sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at Sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at Sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at Java.lang.reflect.Constructor.newInstance(Unknown Source)
at org.Apache.spark.repl.SparkILoop.createSQLContext(SparkILoop.scala:1028)
at $iwC$$iwC.<init>(<console>:9)
at $iwC.<init>(<console>:18)
at <init>(<console>:20)
at .<init>(<console>:24)
at .<clinit>(<console>)
at .<init>(<console>:7)
at .<clinit>(<console>)
at $print(<console>)
at Sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at Sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at Sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at Java.lang.reflect.Method.invoke(Unknown Source)
at org.Apache.spark.repl.SparkIMain$ReadEvalPrint.call(SparkIMain.scala:1065)
at org.Apache.spark.repl.SparkIMain$Request.loadAndRun(SparkIMain.scala:1340)
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.sca la:108)
at org.Apache.spark.repl.SparkILoop.postInitialization(SparkILoop.scala:64)
at org.Apache.spark.repl.SparkILoop$$anonfun$org$Apache$spark$repl$SparkILoop$$proc ess$1.apply$mcZ$sp(SparkILoop.scala:991)
at org.Apache.spark.repl.SparkILoop$$anonfun$org$Apache$spark$repl$SparkILoop$$proc ess$1.apply(SparkILoop.scala:945)
at org.Apache.spark.repl.SparkILoop$$anonfun$org$Apache$spark$repl$SparkILoop$$proc ess$1.apply(SparkILoop.scala:945)
at scala.tools.nsc.util.ScalaClassLoader$.savingContextLoader(ScalaClassLoader.scal a: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(Unknown Source)
at Sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at Java.lang.reflect.Method.invoke(Unknown Source)
at org.Apache.spark.deploy.SparkSubmit$.org$Apache$spark$deploy$SparkSubmit$$runMain(SparkSubmit.scala:672)
at org.Apache.spark.deploy.SparkSubmit$.doRunMain$1(SparkSubmit.scala:180)
at org.Apache.spark.deploy.SparkSubmit$.submit(SparkSubmit.scala:205)
at org.Apache.spark.deploy.SparkSubmit$.main(SparkSubmit.scala:120)
at org.Apache.spark.deploy.SparkSubmit.main(SparkSubmit.scala)
Caused by: Java.lang.NullPointerException
at Java.lang.ProcessBuilder.start(Unknown Source)
at org.Apache.hadoop.util.Shell.runCommand(Shell.Java:445)
at org.Apache.hadoop.util.Shell.run(Shell.Java:418)
at org.Apache.hadoop.util.Shell$ShellCommandExecutor.execute(Shell.Java:650)
at org.Apache.hadoop.util.Shell.execCommand(Shell.Java:739)
at org.Apache.hadoop.util.Shell.execCommand(Shell.Java:722)
at org.Apache.hadoop.fs.FileUtil.execCommand(FileUtil.Java:1097)
at org.Apache.hadoop.fs.RawLocalFileSystem$DeprecatedRawLocalFileStatus.loadPermissionInfo(RawLocalFileSystem.Java:559)
at org.Apache.hadoop.fs.RawLocalFileSystem$DeprecatedRawLocalFileStatus.getPermission(RawLocalFileSystem.Java:534)
org.Apache.hadoop.Hive.ql.session.SessionState.createRootHDFSDir(SessionState.Java:599)
at org.Apache.hadoop.Hive.ql.session.SessionState.createSessionDirs(SessionState.Java:554)
org.Apache.hadoop.Hive.ql.session.SessionState.start (SessionState.Java:508) ... 56 mehr
<console>:10: error: not found: value sqlContext
import sqlContext.implicits._
^
<console>:10: error: not found: value sqlContext
import sqlContext.sql
^
Ich habe Spark 1.5.2 mit Hadoop 2.6 verwendet und hatte ähnliche Probleme. Gelöst durch die folgenden Schritte:
Laden Sie winutils.exe
aus dem Repository in einen lokalen Ordner herunter, z. C:\hadoop\bin
.
Setzen Sie HADOOP_HOME
auf C:\hadoop
.
c:\tmp\Hive
-Verzeichnis erstellen (mit Windows Explorer oder einem anderen Tool).
Öffnen Sie die Eingabeaufforderung mit Administratorrechten.
C:\hadoop\bin\winutils.exe chmod 777 /tmp/Hive
ausführen
Damit bekomme ich immer noch einige Warnungen, aber keine Fehler und kann Spark-Anwendungen problemlos ausführen.
Ich war mit einem ähnlichen Problem konfrontiert und habe das winutil im bin-Ordner abgelegt. Das Hadoop_Home sollte als C:\Winutils und Winutil für C:\Winutils\bin festgelegt werden.
Windows 10 64-Bit-Winutils sind in https://github.com/steveloughran/winutils/tree/master/hadoop-2.6.0/bin verfügbar.
Stellen Sie außerdem sicher, dass die Befehlszeile über Administratorrechte verfügt.
Meine Vermutung ist, dass Sie auf https://issues.Apache.org/jira/browse/SPARK-10528 stoßen. Ich habe das gleiche Problem unter Windows 7 gesehen. Anfangs bekam ich wie Sie die NullPointerException. Wenn ich winutils in das Verzeichnis bin und HADOOP_HOME auf das Spark-Verzeichnis verweise, habe ich den in der JIRA-Ausgabe beschriebenen Fehler erhalten.
Oder vielleicht ist dieser Link hier unten einfacher zu folgen,
https://wiki.Apache.org/hadoop/WindowsProblems
Laden Sie die Datei winutils.exe grundsätzlich herunter und kopieren Sie sie in Ihren spark\bin-Ordner. Funken-Shell erneut ausführen
Wenn Sie/tmp/hive nicht auf einen schreibbaren Status gesetzt haben, tun Sie dies bitte.
Für Python - Erstellen Sie eine SparkSession in Ihrem Python (Dieser Konfigurationsabschnitt ist nur für Windows)
spark = SparkSession.builder.config("spark.sql.warehouse.dir", "C:/temp").appName("SparkSQL").getOrCreate()
Kopiere winutils.exe und behalte es in C:\winutils\bin und führe die folgenden Befehle aus
C:\Windows\system32>C:\winutils\bin\winutils.exe chmod 777 C:/temp
Eingabeaufforderung im ADMIN-Modus ausführen (Als Administrator ausführen)
Sie müssen dem Verzeichnis/tmp/Hive die Berechtigung erteilen, um diese Ausnahme aufzulösen.
Ich hoffe, Sie haben bereits winutils.exe und setzen die Umgebungsvariable HADOOP_HOME. Öffnen Sie dann die Eingabeaufforderung und führen Sie den folgenden Befehl als Administrator aus:
Wenn winutils.exe in D:\winutils\bin gespeichert ist und \ tmp\Hive sich auch im Laufwerk D befindet:
D:\winutils\bin\winutils.exe chmod 777 D:\tmp\Hive
Für weitere Details können Sie die folgenden Links verwenden:
Häufige Probleme während der Spark-Entwicklung aufgetreten
So führen Sie Apache Spark unter Windows 7 im Standalone-Modus aus
Mein Problem war, andere .exes/Jars im Ordner winutils/bin zu haben. Also habe ich alle anderen gelöscht und war allein mit winutils.exe übrig. Verwendete Funken 2.1.1
Sie können dieses Problem beheben, indem Sie die mysqlconnector-jar in den Ordner spark-1.6.0/libs stellen und erneut starten.
Das Wichtigste ist hier, anstatt Spark-Shell auszuführen, sollten Sie es tun
spark-Shell --driver-class-path /home/username/spark-1.6.0-libs-mysqlconnector.jar
Ich hoffe es sollte klappen.
In Windows müssen Sie "winutils" klonen
git clone https://github.com/steveloughran/winutils.git
Und
set var HADOOP_HOME to DIR_CLONED\hadoop-{version}
Denken Sie daran, die Version Ihres hadoop zu wählen.
Das Problem wurde nach der Installation der korrekten Java-Version in meinem Fall Java 8 und dem Einstellen der Umgebungsvariablen behoben. Stellen Sie sicher, dass Sie die Datei "winutils.exe" ausführen, um ein temporäres Verzeichnis zu erstellen.
c:\winutils\bin\winutils.exe chmod 777 \tmp\Hive
Oben sollte kein Fehler zurückgegeben werden. Verwenden Sie Java -version
, um die verwendete Java-Version zu überprüfen, bevor Sie spark-Shell aufrufen.