当前位置: 首页 > 工具软件 > share lib > 使用案例 >

oozie的sharelib没有正确放到hadoop中,导致异常/user/oozie/share/lib does not exist

萧玮
2023-12-01

一、异常表现

    通常情况下,正确的安装oozie,其share lib都会放到Hadoop的/user/oozie/share/lib目录中,但是也有可能在出现某种情况异常如权限不对等的情况下,导致/user/oozie/share/lib没有正确的放入oozie的share lib,其错误可能表示为如下已知的两种情况:

    1、通过HUE的界面的QUERY->Editor->Java界面,上传可通过Hadoop命令"hadoop jar xxx.jar"正确执行的jar包,并填写相应的包名,然后点击执行,报错如下:
2018-04-17 08:22:27,897 WARN org.apache.oozie.command.wf.ActionStartXCommand: SERVER[ip-172-17-30-53] USER[admin] GROUP[-] TOKEN[] APP[Batch for query-java] JOB[0000000-180320055420500-oozie-oozi-W] ACTION[0000000-180320055420500-oozie-oozi-W@java-ec94] Error starting action [java-ec94]. ErrorType [FAILED], ErrorCode [It should never happen], Message [File /user/oozie/share/lib does not exist.]
org.apache.oozie.action.ActionExecutorException: File /user/oozie/share/lib does not exist.
	at org.apache.oozie.action.hadoop.JavaActionExecutor.addSystemShareLibForAction(JavaActionExecutor.java:761)

    2、通过HUE的workflow界面配置hive2的sql script执行脚本,执行时报错如下:
2018-04-18 05:46:18,763 WARN [main] org.apache.hadoop.mapred.YarnChild: Exception running child : java.io.IOException: Split class org.apache.oozie.action.hadoop.OozieLauncherInputFormat$EmptySplit not found

需要执行的SQL在Hive执行界面是正常的。


二、错误分析

通过命令"hadoop fs -ls /user"命令查看文件目录,确实不存在/user/oozie路径,说明oozie的sharelib没有放到hdfs上,我们现在要做的就是将oozie的share lib放到Hadoop的对应目录中。


三、错误的解决步骤

这是走过的一些弯路,记下来,以免以后再走同样的弯路。

1、将oozie的源码下载到本地:

git clone git://git.apache.org/oozie.git
2、编译
bin/mkdistro.sh -DskipTests
这个需要一定的时间,因为要下载的东西比较多
oozie的安装详细介绍: https://oozie.apache.org/docs/4.0.0/DG_QuickStart.html
3、将编译好的share包,sharelib/target/oozie-sharelib-5.1.0-SNAPSHOT.tar.gz上传到oozie所在的服务器,我使用的是CDH安装的,就上传到目录/data/opt/cloudera/parcels/CDH-5.13.1-1.cdh5.13.1.p0.2/lib/oozie下。
4、执行安装oozie sharelib的命令:
sudo -u oozie bin/oozie-setup.sh sharelib create -fs hdfs://172.17.30.146:8020 -locallib oozie-sharelib-5.1.0-SNAPSHOT.tar.gz
5、报错如下:
org.apache.oozie.service.ServiceException: E0024: Oozie configuration directory does not exist [/data/opt/cloudera/parcels/CDH-5.13.1-1.cdh5.13.1.p0.2/lib/oozie/conf]
	at org.apache.oozie.service.ConfigurationService.getConfigurationDirectory(ConfigurationService.java:176)
	at org.apache.oozie.service.XLogService.init(XLogService.java:138)
	at org.apache.oozie.service.Services.setServiceInternal(Services.java:386)
	at org.apache.oozie.service.Services.<init>(Services.java:111)
	at org.apache.oozie.tools.OozieSharelibCLI.run(OozieSharelibCLI.java:155)
	at org.apache.oozie.tools.OozieSharelibCLI.main(OozieSharelibCLI.java:67
6、通过find命令查看oozie的配置文件:
root@ip-172-17-30-53:/data/opt/cloudera/parcels/CDH-5.13.1-1.cdh5.13.1.p0.2/lib/oozie# find / -name "oozie-site.xml"
/run/cloudera-scm-agent/process/554-oozie-OOZIE_SERVER/oozie-site.xml
/data/opt/cloudera/parcels/CDH-5.13.1-1.cdh5.13.1.p0.2/etc/oozie/conf.dist/oozie-site.xml
7、在当前目录建立oozie配置文件目录conf的软连接:
ln -s /data/opt/cloudera/parcels/CDH-5.13.1-1.cdh5.13.1.p0.2/etc/oozie/conf.dist conf
8、再次执行安装oozie sharelib的命令:
sudo -u oozie bin/oozie-setup.sh sharelib create -fs hdfs://172.17.30.146:8020 -locallib oozie-sharelib-5.1.0-SNAPSHOT.tar.gz
提示安装成功,安装完成后,可以通过以下命令查看:
sudo -u oozie oozie  admin -shareliblist -oozie http://localhost:11000/oozie
也可以通过hadoop fs /user/oozie/share/lib命令查看
参考: http://gethue.com/running-an-oozie-workflow-and-getting-split-class-org-apache-oozie-action-hadoop-oozielauncherinputformatemptysplit-not-found
9、但是在控制台重新执行的时候,还是报错误“org.apache.oozie.action.ActionExecutorException: Could not locate Oozie sharelib”
10、重启oozie,或者执行以下更新oozie sharelib的命令:
oozie admin -sharelibupdate -oozie http://localhost:11000/oozie
11、但是在重新执行的时候,还是报以下的错误:
2018-04-18 05:46:18,763 WARN [main] org.apache.hadoop.mapred.YarnChild: Exception running child : java.io.IOException: Split class org.apache.oozie.action.hadoop.OozieLauncherInputFormat$EmptySplit not found
查看从git上拉下来的oozie sharelib的源码,里面确实没有类OozieLauncherInputFormat这个类,此时就不好解决了。
参考:https://stackoverflow.com/questions/42471940/oozie-sharelib-does-not-exists


四、正确的解决步骤

1、根据这篇文章
http://gethue.com/running-an-oozie-workflow-and-getting-split-class-org-apache-oozie-action-hadoop-oozielauncherinputformatemptysplit-not-found
所谈到的,如果出现以下异常:
“File /user/oozie/share/lib does not exist” 或 “org.apache.oozie.action.hadoop.OozieLauncherInputFormat$EmptySplit not found”
这样的异常,通常都是oozie的sharelib没有正确安装,如版本不对等都是问题。
文章中谈到的重新创建oozie的sharelib都是使用的是oozie-sharelib-yarn.tar.gz这样的包,但是经过搜索oozie-sharelib-yarn.tar.gz,网上确实找不到对应版本的文件,通过查看cdh的oozie的安装目录下,存在着名为oozie-sharelib-yarn这样的目录,既然oozie在CDH中可以正常运行,那说明这里面包括的内容是正确并且符合当前版本的,于是想到把这个目录的内容打包,然后用这份内容来做sharelib。
2、复制oozie-sharelib-yarn一份为share目录:
cp -r oozie-sharelib-yarn share
3、查看目录里面有许多jar包都是软链接,因而在打包之前需要将里面的软链接替换为真正的内容。打开以下网页:
https://blog.csdn.net/qianlong4526888/article/details/54667840
把里面的代码拷贝出来,并存为一个可执行的shell文件,然后放到share/lib目录去执行,就把里面的软链接删除的同时,并且会把软链接对应的真实jar拷贝过来。
3)打包:
tar czf share.tar.gz share
4)执行安装oozie sharelib的命令:
sudo -u oozie bin/oozie-setup.sh sharelib create -fs hdfs://172.17.30.146:8020 -locallib share.tar.gz
5)报错如下:
org.apache.oozie.service.ServiceException: E0024: Oozie configuration directory does not exist [/data/opt/cloudera/parcels/CDH-5.13.1-1.cdh5.13.1.p0.2/lib/oozie/conf]
	at org.apache.oozie.service.ConfigurationService.getConfigurationDirectory(ConfigurationService.java:176)
	at org.apache.oozie.service.XLogService.init(XLogService.java:138)
	at org.apache.oozie.service.Services.setServiceInternal(Services.java:386)
	at org.apache.oozie.service.Services.<init>(Services.java:111)
	at org.apache.oozie.tools.OozieSharelibCLI.run(OozieSharelibCLI.java:155)
	at org.apache.oozie.tools.OozieSharelibCLI.main(OozieSharelibCLI.java:67
6)通过find命令查看oozie的配置文件:
root@ip-172-17-30-53:/data/opt/cloudera/parcels/CDH-5.13.1-1.cdh5.13.1.p0.2/lib/oozie# find / -name "oozie-site.xml"
/run/cloudera-scm-agent/process/554-oozie-OOZIE_SERVER/oozie-site.xml
/data/opt/cloudera/parcels/CDH-5.13.1-1.cdh5.13.1.p0.2/etc/oozie/conf.dist/oozie-site.xml
7)在当前目录建立oozie配置文件目录conf的软连接:
ln -s /data/opt/cloudera/parcels/CDH-5.13.1-1.cdh5.13.1.p0.2/etc/oozie/conf.dist conf
8)再次执行安装oozie sharelib的命令:
sudo -u oozie bin/oozie-setup.sh sharelib create -fs hdfs://172.17.30.146:8020 -locallib share.tar.gz
提示安装成功,安装完成后,可以通过以下命令查看:
sudo -u oozie oozie  admin -shareliblist -oozie http://localhost:11000/oozie
也可以通过hadoop fs /user/oozie/share/lib命令查看

 类似资料: