Spark-submit ClassNotFound exception

前端 未结 5 941
我寻月下人不归
我寻月下人不归 2020-12-29 06:01

I\'m having problems with a \"ClassNotFound\" Exception using this simple example:

import org.apache.spark.SparkContext
import org.apache.spark.SparkContext.         


        
5条回答
  •  感动是毒
    2020-12-29 06:27

    If you are using Maven and Maven Assembly plugin to build your jar file with mvn package, ensure that the assembly plugin is configured correctly to point to your Spark app's main class.

    Something like this should be added to your pom.xml to avoid any java.lang.ClassNotFoundException's:

               
                org.apache.maven.plugins
                maven-assembly-plugin
                2.4.1
                
                    
                        
                            com.my.package.SparkDriverApp
                        
                    
                    
                        jar-with-dependencies
                    
                    false
                
                
                    
                        package
                        package
                        
                            single
                        
                    
                
            
    

提交回复
热议问题