package example
Import the typesafe. Scalalogging. LazyLogging
The import org. Apache. Spark. {SparkConf, SparkContext}
The object SparkExample extends LazyLogging {
Private val master="spark://master: 7077
Private val appName="example - spark"
Private val stopWords=Set (" GIF ", "PNG")
Def main (args: Array [String]) : Unit={
Val conf=new SparkConf ()
. SetMaster (master)
. SetAppName (appName)
Val sc=new SparkContext (conf)
Val lines=sc. TextFile (" file:/home/qiujl/access log ")
Val wordsCount=wordsCount. Count (sc, lines, stopWords)
Val counts=wordsCount. Collect (). MkString ("/", ", ", "")
Logger. The info (counts)
}
}
The following error:
[QWWSL @ master ~] $spark - submit - master spark://master: 48-7077 - num - executors driver - 2 g memory -- executor - 7 g - executor - memory cores 3/home/qiujl/example - spark - master. Jar
18/05/30 10:27:38 WARN NativeCodeLoader: Unable to load the native - hadoop library for your platform... Using the builtin - Java classes where applicable
Java. Lang. ClassNotFoundException: example. SparkExample
The at java.net.URLClassLoader.findClass URLClassLoader. Java: (381)
The at Java. Lang. This. LoadClass (424). This Java:
The at Java. Lang. This. LoadClass (357). This Java:
The at Java. Lang. Class. ForName0 (Native Method)
The at Java. Lang. Class.forname (348) Class. Java:
The at org. Apache. Spark. Util. Utils $. ClassForName (Utils. Scala: 235)
The at org.apache.spark.deploy.SparkSubmit$.org $$$$$$runMain SparkSubmit deploy spark apache (SparkSubmit. Scala: 836)
The at org. Apache. Spark. Deploy. SparkSubmit $. DoRunMain $1 (197). SparkSubmit scala:
The at org. Apache. Spark. Deploy. SparkSubmit $. Submit (SparkSubmit. Scala: 227)
The at org. Apache. Spark. Deploy. SparkSubmit $. The main (SparkSubmit. Scala: 136)
The at org. Apache. Spark. Deploy. SparkSubmit. Main (SparkSubmit. Scala)
CodePudding user response:
Java. Lang. ClassNotFoundException: example. SparkExampleYour code is not into the jar
CodePudding user response: