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}指專案所在路徑。
相關文章
- hive on tez踩坑記2-hive0.14 on tez薦Hive
- hive metastore異常 org.apache.thrift.protocol.TProtocolException: Missing version in readMessageBegin, old clientHiveASTApacheProtocolExceptionclient
- spark讀取hdfs資料本地性異常Spark
- 遭遇java.lang.NoClassDefFoundError:org/apache/tomcat/PeriodicEventListenerJavaErrorApacheTomcat
- java.lang.NoClassDefFoundError: org/apache/ibatis/session/SqlSessionFactoryJavaErrorApacheBATSessionSQL
- Hive On Tez自定義Job NameHive
- Apache Spark和Hive有用的功能ApacheSparkHive
- Spark讀取Hbase報錯NoSuchMethodError: org.apache.hadoop.conf.Configuration.getPassword(Ljava/lang/String;SparkErrorApacheHadoopJava
- 異常:java.lang.NoSuchMethodError: org.apache.poi.ss.usermodel.Workbook.getCellStyleAtJavaErrorApache
- Hive1.2.1 啟動報錯 ClassNotFoundException: org.apache.hadoop.hive.service.HiveServerHiveExceptionApacheHadoopServer
- Exception in thread “main“ java.lang.NoClassDefFoundError: org/apache/http/conn/socket/LayeredConnecExceptionthreadAIJavaErrorApacheHTTP
- Java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory 解決方案JavaErrorApache
- org.apache.ibatis.exceptions.PersistenceException:記錄mybatis 查詢結果對映異常ApacheExceptionMyBatis
- 一個異常org.apache.jasper.JasperException: java.lang.IllegalStateException: No output folder:的解決...ApacheExceptionJava
- spark with hiveSparkHive
- Python xlrd讀取excel異常處理PythonExcel
- sort-based shuffle的核心:org.apache.spark.util.collection.ExternalSorterApacheSpark
- java.lang.NoClassDefFoundError: org/json/JSONObjectJavaErrorJSONObject
- 匯出Excel過程中遇到的問題java.lang.NoClassDefFoundError: org/apache/xmlbeans/XmlExceptionExcelJavaErrorApacheXMLBeanException
- 快取Apache Spark RDD - 效能調優快取ApacheSpark
- 解決Spark讀取Hive分割槽表出現Input path does not exist的問題SparkHive
- hive on spark配置HiveSpark
- Spark整合hiveSparkHive
- hive on spark on yarnHiveSparkYarn
- Apache Spark常見的三大誤解ApacheSpark
- [持續更新]hive異常解決方案Hive
- Spark 線性迴歸模型異常Spark模型
- Spark讀取MySQL資料SparkMySql
- Spark----RDD運算元分類 DAGSpark
- Hive on Spark和Spark sql on Hive,你能分的清楚麼HiveSparkSQL
- Hive on Spark 和 Spark sql on Hive,你能分的清楚麼HiveSparkSQL
- hive、spark優化HiveSpark優化
- spark讀取hbase的資料Spark
- Spark讀取elasticsearch資料指南SparkElasticsearch
- spark2.2.0 配置spark sql 操作hiveSparkSQLHive
- Hive多視窗啟動異常(已解決!)Hive
- 異常org.hibernate.QueryException: could not resolve property的原因Exception
- 異常解決:NoClassDefFoundError: org/w3c/css/sac/ErrorHandlerErrorCSS