通过sqoop导入表时遇到问题。 Sqoop似乎已正确安装并使用正确的驱动程序。但是,当作业尝试执行时,我收到了YarnException错误。
运行以下命令尝试导入表。
sqoop import --connect jdbc:ingres://server:xxx/cif_db --username xxx --password xxx --table zzz -m 1 --driver com.ingres.jdbc.IngresDriver
在上面运行sqoop导入命令时,产生以下错误。
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/hadoop/yarn/exceptions/YarnException
at org.apache.hadoop.mapred.YarnClientProtocolProvider.create(YarnClientProtocolProvider.java:34)
at org.apache.hadoop.mapreduce.Cluster.initialize(Cluster.java:121)
at org.apache.hadoop.mapreduce.Cluster.<init>(Cluster.java:108)
at org.apache.hadoop.mapreduce.Cluster.<init>(Cluster.java:101)
at org.apache.hadoop.mapreduce.Job$9.run(Job.java:1277)
at org.apache.hadoop.mapreduce.Job$9.run(Job.java:1273)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:415)
at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1671)
at org.apache.hadoop.mapreduce.Job.connect(Job.java:1272)
at org.apache.hadoop.mapreduce.Job.submit(Job.java:1301)
at org.apache.hadoop.mapreduce.Job.waitForCompletion(Job.java:1325)
at org.apache.sqoop.mapreduce.ImportJobBase.doSubmitJob(ImportJobBase.java:203)
at org.apache.sqoop.mapreduce.ImportJobBase.runJob(ImportJobBase.java:176)
at org.apache.sqoop.mapreduce.ImportJobBase.runImport(ImportJobBase.java:273)
at org.apache.sqoop.manager.SqlManager.importTable(SqlManager.java:692)
at org.apache.sqoop.tool.ImportTool.importTable(ImportTool.java:513)
at org.apache.sqoop.tool.ImportTool.run(ImportTool.java:621)
at org.apache.sqoop.Sqoop.run(Sqoop.java:147)
at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:70)
at org.apache.sqoop.Sqoop.runSqoop(Sqoop.java:183)
at org.apache.sqoop.Sqoop.runTool(Sqoop.java:234)
at org.apache.sqoop.Sqoop.runTool(Sqoop.java:243)
at org.apache.sqoop.Sqoop.main(Sqoop.java:252)
Caused by: java.lang.ClassNotFoundException: org.apache.hadoop.yarn.exceptions.YarnException
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
... 24 more
我尝试使用以下方法成功列出数据库中的表。
sqoop list-tables --connect jdbc:ingres://server:xxx/xxx_db --username xxx --password xxx --driver com.ingres.jdbc.IngresDriver
我还试图将可能丢失的罐子包括在内,但没有运气。
sqoop import --libjars /home/xxx/hadoop-yarn-common-2.6.0-cdh5.12.1.jar --libjars /home/xxx/hadoop-yarn-api.jar --connect jdbc:ingres://server:xxx/xxx_db --username xxx --password xxx --table zzz -m 1 --driver com.ingres.jdbc.IngresDriver
对于解决方法的任何想法或建议,我们将不胜感激。