Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/spark/sql/
从spark2.4升级到spark3.0,在跑spark任务的时候,报了一下错误:
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/spark/sql/internal/connector/SimpleTableProvider
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:467)
at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
at java.net.URLClassLoader$1.run(URLClassLoader.java:368)
at java.net.URLClassLoader$1.run(URLClassLoader.java:362)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:361)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:348)
at java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:370)
at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:404)
at java.util.ServiceLoader$1.next(ServiceLoader.java:480)
at scala.collection.convert.Wrappers$JIteratorWrapper.next(Wrappers.scala:43)
at scala.collection.Iterator$class.foreach(Iterator.scala:891)
at scala.collection.AbstractIterator.foreach(Iterator.scala:1334)
at scala.collection.IterableLike$class.foreach(IterableLike.scala:72)
at scala.collection.AbstractIterable.foreach(Iterable.scala:54)
at scala.collection.TraversableLike$class.filterImpl(TraversableLike.scala:247)
at scala.collection.TraversableLike$class.filter(TraversableLike.scala:259)
at scala.collection.AbstractTraversable.filter(Traversable.scala:104)
at org.apache.spark.sql.execution.datasources.DataSource$.lookupDataSource(DataSource.scala:630)
at org.apache.spark.sql.DataFrameWriter.save(DataFrameWriter.scala:245)
at org.apache.spark.sql.DataFrameWriter.save(DataFrameWriter.scala:229)
at com.huitongjy.data.access.DeltaLake$.main(DeltaLake.scala:19)
at com.huitongjy.data.access.DeltaLake.main(DeltaLake.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:849)
at org.apache.spark.deploy.SparkSubmit.doRunMain$1(SparkSubmit.scala:167)
at org.apache.spark.deploy.SparkSubmit.submit(SparkSubmit.scala:195)
at org.apache.spark.deploy.SparkSubmit.doSubmit(SparkSubmit.scala:86)
at org.apache.spark.deploy.SparkSubmit$$anon$2.doSubmit(SparkSubmit.scala:924)
at org.apache.spark.deploy.SparkSubmit$.main(SparkSubmit.scala:933)
at org.apache.spark.deploy.SparkSubmit.main(SparkSubmit.scala)
Caused by: java.lang.ClassNotFoundException: org.apache.spark.sql.internal.connector.SimpleTableProvider
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 41 more
解决办法: 使用命令spark-submit --version查看spark版本,看是否还是2.X的版本,然后查看环境变量。
推荐阅读
-
Exception in thread “main“ org.apache.spark.SparkException: Task not serializable
-
Exception in thread "main" org.apache.spark.SparkException: Task not serializable
-
运行Spark程序时出现 Exception in thread “main“ org.apache.spark.SparkException: A master URL must be set
-
Exception in thread "main" java.lang.NoClassDefFoundError: org/eclipse/jetty/server/SessionManager
-
Exception in thread "main" org.apache.spark.SparkException: Application application_1498149692663_01
-
Exception in thread "main" org.apache.hadoop.security.AccessControlException: Permission deniedUse
-
hadoop客户端操作出现:Exception in thread "main" org.apache.hadoop.security.AccessControlException:
-
Exception in thread "main" java.lang.NoSuchMethodError: org.apache.commons.io.IOUtils.toString(Ljava
-
Exception in thread “main“ java.lang.NoClassDefFoundError: org/mybatis/generator/api/dom/xml/Element
-
IDEA运行SparkSql代码 出现 java.lang.NoClassDefFoundError: org/apache/spark/sql/AnalysisException