gpt4 book ai didi

java - Spark提交:使用jar找不到表或 View

转载 作者:行者123 更新时间:2023-12-02 18:38:25 25 4
gpt4 key购买 nike

当我从intellij ide运行HiveRead.java时,我可以成功运行并获得结果。然后我创建了jar文件(这是一个maven项目),然后尝试从IDE运行,它给了我

ClassLoaderResolver for class "" gave error on creation : {1}

然后我查看了答案,发现我必须添加数据奶 jar ,我做了这样的事情
java -jar /home/saurab/sparkProjects/spark_hive/target/myJar-jar-with-dependencies.jar --jars jars/datanucleus-api-jdo-3.2.6.jar,jars/datanucleus-core-3.2.10.jar,jars/datanucleus-rdbms-3.2.9.jar,/home/saurab/hadoopec/hive/lib/mysql-connector-java-5.1.38.jar

然后我得到了这个错误
org.datanucleus.exceptions.NucleusUserException: Persistence process has been specified to use a ClassLoaderResolver of name "datanucleus" yet this has not been found by the DataNucleus plugin mechanism. Please check your CLASSPATH and plugin specification.

我发现应该在某个地方执行 spark-submit。所以我就这样
./bin/spark-submit --class HiveRead --master yarn  --jars jars/datanucleus-api-jdo-3.2.6.jar,jars/datanucleus-core-3.2.10.jar,jars/datanucleus-rdbms-3.2.9.jar,/home/saurab/hadoopec/hive/lib/mysql-connector-java-5.1.38.jar --files /home/saurab/hadoopec/spark/conf/hive-site.xml /home/saurab/sparkProjects/spark_hive/target/myJar-jar-with-dependencies.jar

现在我得到了新的错误类型
Table or view not found: `bigmart`.`o_sales`; 

帮我 !! :)

我已将 hive-site.xml复制到 /spark/conf,开始了hive-metastore服务( hiveserver2 --service metastore)

如果有人感兴趣,这里是 HiveRead.Java code

最佳答案

Spark session 无法读取配置单元目录。

为hive-site.xml文件路径提供spark-submit命令,如下所示。

对于hortonworks-文件路径/usr/hdp/current/spark2-client/conf/hive-site.xml

在spark-submit命令中将其作为--files /usr/hdp/current/spark2-client/conf/hive-site.xml传递。

关于java - Spark提交:使用jar找不到表或 View ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45317974/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com