Yarn 作业因 ClassNotFound 异常而失败,但在 HADOOP_CLASSPATH 中添加了 jar

Yarn job failed with ClassNotFound exception but jar was added in HADOOP_CLASSPATH

我对 Hive WebHcat 和 Yarn 有一些疑问。 当我尝试通过 curl 在配置单元中创建 table 时,例如:

curl -s -d execute="select+*+from+pokes;" \ -d statusdir="pokes.output" \
'http://localhost:50111/templeton/v1/hive?user.name=ekoifman'

https://cwiki.apache.org/confluence/display/Hive/WebHCat+Reference+Hive

Yarn 容器失败

Error: java.lang.ClassNotFoundException: org.apache.logging.log4j.spi.LoggerContextFactory

但 Hive class 路径中存在所需的 jar,当我启动 WebHcat 时,我在 Hadoop class 路径中显式添加了 log4j-api-2.4.1.jar在 https://github.com/apache/hive/blob/master/hcatalog/webhcat/svr/src/main/bin/webhcat_server.sh#L211-L215

所以问题是为什么 yarn 容器找不到位于 hive class 路径并显式添加到 hadoop_classpath 中的 jar?

谢谢。

我将已存在于 hive 类路径中的 log4j 库添加到 yarn 类路径后问题得到解决。