spark讀取hive異常,java.lang.NoClassDefFoundError: org/apache/tez/dag/api/SessionNotRunning
環境:
HDP2.6.4
Spark2.2.0
Hive1.2.1
背景:
使用spark程式碼讀取hive表資料,寫入clickhouse表,相同的程式碼在其他HDP叢集正常使用,更換新環境後,報以下異常:
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/tez/dag/api/SessionNotRunning
at org.apache.hadoop.hive.ql.session.SessionState.start(SessionState.java:529)
at org.apache.spark.sql.hive.thriftserver.SparkSQLCLIDriver$.main(SparkSQLCLIDriver.scala:133)
at org.apache.spark.sql.hive.thriftserver.SparkSQLCLIDriver.main(SparkSQLCLIDriver.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:904)
at org.apache.spark.deploy.SparkSubmit$.doRunMain$1(SparkSubmit.scala:198)
at org.apache.spark.deploy.SparkSubmit$.submit(SparkSubmit.scala:228)
at org.apache.spark.deploy.SparkSubmit$.main(SparkSubmit.scala:137)
at org.apache.spark.deploy.SparkSubmit.main(SparkSubmit.scala)
Caused by: java.lang.ClassNotFoundException: org.apache.tez.dag.api.SessionNotRunning
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 13 more
這個異常十分不理解,因為程式碼沒變,純粹的環境問題。
最終確認異常點,是hive-site.xml檔案的問題。
解決方案:
將HDP中spark2/conf目錄下的hive-site.xml檔案替換掉專案conf目錄下的hive-site.xml檔案,保證spark2執行時讀取的hive-site.xml和環境中spark2的檔案保持一致,即可。
cp /etc/spark2/conf/hive-site.xml ${project}/conf/dev/
${project}指專案所在路徑。
相關文章
- spark讀取hdfs資料本地性異常Spark
- Spark讀取Hbase報錯NoSuchMethodError: org.apache.hadoop.conf.Configuration.getPassword(Ljava/lang/String;SparkErrorApacheHadoopJava
- Exception in thread “main“ java.lang.NoClassDefFoundError: org/apache/http/conn/socket/LayeredConnecExceptionthreadAIJavaErrorApacheHTTP
- Hive On Tez自定義Job NameHive
- Apache Spark和Hive有用的功能ApacheSparkHive
- 異常:java.lang.NoSuchMethodError: org.apache.poi.ss.usermodel.Workbook.getCellStyleAtJavaErrorApache
- org.apache.ibatis.exceptions.PersistenceException:記錄mybatis 查詢結果對映異常ApacheExceptionMyBatis
- spark with hiveSparkHive
- 快取Apache Spark RDD - 效能調優快取ApacheSpark
- Apache Spark常見的三大誤解ApacheSpark
- is java.lang.NoClassDefFoundError: org/springframework/dao/support/DaoSupport錯誤原因JavaErrorSpringFramework
- Spark整合hiveSparkHive
- hive on spark配置HiveSpark
- [持續更新]hive異常解決方案Hive
- Spark讀取MySQL資料SparkMySql
- Hive on Spark 和 Spark sql on Hive,你能分的清楚麼HiveSparkSQL
- Hive on Spark和Spark sql on Hive,你能分的清楚麼HiveSparkSQL
- Spark----RDD運算元分類 DAGSpark
- hive、spark優化HiveSpark優化
- Spark讀取elasticsearch資料指南SparkElasticsearch
- spark讀取hbase的資料Spark
- flink sql client讀取hive時卡住SQLclientHive
- spark2.2.0 配置spark sql 操作hiveSparkSQLHive
- Hive多視窗啟動異常(已解決!)Hive
- org.apache.shiro.authc.UsernamePasswordTokenApache
- 報錯:nested exception is java.lang.NoClassDefFoundError: org/fusesource/hawtbuf/UTF8BufferExceptionJavaError
- Redis快取篇(四)快取異常Redis快取
- MapReduce和Spark讀取HBase快照表Spark
- mybatis配置執行報出Caused by: org.apache.ibatis.binding.BindingException:相關錯誤解決或者空指標異常MyBatisApacheException指標
- api模式下修改異常類ExceptionAPI模式Exception
- Django REST framework API 指南(24):異常DjangoRESTFrameworkAPI
- Spark報錯(二):關於Spark-Streaming官方示例wordcount執行異常Spark
- MongoDB Java開發從Mongo讀取Object值轉Long異常引起的資料型別轉換異常MongoDBJavaObject資料型別
- HashMap中ConcurrentModificationException異常解讀HashMapException
- Maven-org.apache.ibatis.binding.BindingExceptionMavenApacheBATException
- hive on spark記憶體模型HiveSpark記憶體模型
- Hive和Spark分割槽策略HiveSpark
- spark寫入hive資料SparkHive