Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/spark/SparkConf

标题Spark Mavem项目在本地测试报错 : Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/spark/SparkConf
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/spark/SparkConf
	at StreamingT$.main(StreamingT.scala:8)
	at StreamingT.main(StreamingT.scala)
Caused by: java.lang.ClassNotFoundException: org.apache.spark.SparkConf
	at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
	... 2 more

原因
NoClassDefFoundError表示在运行时找不到类

    
    
        
            org.apache.spark
            spark-core_2.11
            2.3.0
            provided
        
    

provided导致在编译时忽略了这个依赖! 把这行注释掉即可!如果打包时不需要将这个依赖打进去 , 则需要开启!
测试

    
    
        
            org.apache.spark
            spark-core_2.11
            2.3.0
            
        
    

Exception in thread

你可能感兴趣的:(spark报错,maven)