hue 中使用 oozie workflow 运行 shell 脚本执行 sqoop 命令,报错 Launcher ERROR, reason: Main class [org.apache.o...

问题

已验证的写有 sqoop 命令的 shell 脚本(将数据从mysql导入hive),在 hue 中添加到 oozie workflow 中运行报错:
Launcher ERROR, reason: Main class [org.apache.oozie.action.hadoop.ShellMain], exit code [1]

在 cloudera manager 中进入 yarn 界面,查看详细日志:

19/10/18 19:11:56 ERROR sqoop.Sqoop: Got exception running Sqoop: java.lang.RuntimeException: Could not load db driver class: com.mysql.jdbc.Driver
java.lang.RuntimeException: Could not load db driver class: com.mysql.jdbc.Driver
    at org.apache.sqoop.manager.SqlManager.makeConnection(SqlManager.java:874)
    at org.apache.sqoop.manager.GenericJdbcManager.getConnection(GenericJdbcManager.java:59)
    at org.apache.sqoop.manager.CatalogQueryManager.listDatabases(CatalogQueryManager.java:57)
    at org.apache.sqoop.tool.ListDatabasesTool.run(ListDatabasesTool.java:49)
    at org.apache.sqoop.Sqoop.run(Sqoop.java:146)
    at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:76)
    at org.apache.sqoop.Sqoop.runSqoop(Sqoop.java:182)
    at org.apache.sqoop.Sqoop.runTool(Sqoop.java:233)
    at org.apache.sqoop.Sqoop.runTool(Sqoop.java:242)
    at org.apache.sqoop.Sqoop.main(Sqoop.java:251)

可以看到错误是由于缺少mysql驱动导致的。


解决方法:

mysql-connector-java.jar 拷贝到 /opt/cloudera/parcels/CDH/lib/sqoop/lib 下。
再次执行 workflow,成功

你可能感兴趣的:(hue 中使用 oozie workflow 运行 shell 脚本执行 sqoop 命令,报错 Launcher ERROR, reason: Main class [org.apache.o...)