sqoop导入失败,不支持ClassVersionError

afdcj2ne  于 2021-06-03  发布在  Hadoop
关注(0)|答案(3)|浏览(378)

我尝试使用sqoop将表从mysql导入hdfs。使用的命令行是,

sqoop import --connect jdbc:mysql://192.168.10.452/qw_key_test --username qw -P --split-by qw_id -m 10 --target-dir /user/perf/qwperf/sqoops --verbose --table qw_perf_store_key

Map绘制程序失败 Unsupported version 如下所示。

2013-05-22 17:46:24,165 WARN mapreduce.Counters: Group org.apache.hadoop.mapred.Task$Counter is deprecated. Use org.apache.hadoop.mapreduce.TaskCounter instead
2013-05-22 17:46:24,534 WARN org.apache.hadoop.conf.Configuration: session.id is deprecated. Instead, use dfs.metrics.session-id
2013-05-22 17:46:24,535 INFO org.apache.hadoop.metrics.jvm.JvmMetrics: Initializing JVM Metrics with processName=MAP, sessionId=
2013-05-22 17:46:24,835 INFO org.apache.hadoop.util.ProcessTree: setsid exited with exit code 0
2013-05-22 17:46:24,839 INFO org.apache.hadoop.mapred.Task:  Using ResourceCalculatorPlugin : org.apache.hadoop.util.LinuxResourceCalculatorPlugin@191410e5
2013-05-22 17:46:25,278 INFO org.apache.hadoop.mapred.TaskLogsTruncater: Initializing logs' truncater with mapRetainSize=-1 and reduceRetainSize=-1
2013-05-22 17:46:25,280 FATAL org.apache.hadoop.mapred.Child: Error running child : java.lang.UnsupportedClassVersionError: qw_perf_store_key : Unsupported major.minor version 51.0
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
    at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:247)
    at org.apache.hadoop.conf.Configuration.getClassByNameOrNull(Configuration.java:1510)
    at org.apache.hadoop.conf.Configuration.getClassByName(Configuration.java:1475)
    at org.apache.hadoop.conf.Configuration.getClass(Configuration.java:1569)
    at org.apache.sqoop.mapreduce.db.DBConfiguration.getInputClass(DBConfiguration.java:276)
    at org.apache.sqoop.mapreduce.db.DataDrivenDBInputFormat.createDBRecordReader(DataDrivenDBInputFormat.java:230)
    at org.apache.sqoop.mapreduce.db.DBInputFormat.createRecordReader(DBInputFormat.java:236)
    at org.apache.hadoop.mapred.MapTask.runNewMapper(MapTask.java:617)
    at org.apache.hadoop.mapred.MapTask.run(MapTask.java:325)
    at org.apache.hadoop.mapred.Child$4.run(Child.java:268)
    at java.security.AccessController.doPrivileged(Native Method)
    at javax.security.auth.Subject.doAs(Subject.java:396)
    at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1332)
    at org.apache.hadoop.mapred.Child.main(Child.java:262)

你知道吗?使用centos 6.2、cdh4 jdk7_、sqoop:sqoop 1.4.1-cdh4.1.3(git提交id 0ff32b245c1d4c75e9f034414ebd8cfcdd140e7e)

ykejflvf

ykejflvf1#

当sqoop在jdk7上运行而hadoop集群在jdk6上运行时,我就看到了这个问题。确保所有java应用程序都使用相同的主要jdk版本,这样就可以了。

nhn9ugyo

nhn9ugyo2#

我将$javahome更改为j2sdk1.6-oracle,默认情况下安装了cloudera管理器。然后我导出path变量以包含bin,它就工作了。

j13ufse2

j13ufse23#

major.minor版本51.0代表JDK1.7,这也证实了您所说的。JDK1.7似乎与sqoop版本1.4.1-cdh4.1.3不兼容。根据cdh4支持的jdk要求,cdh4.2及更高版本支持JDK1.7。
使用oraclejdk安装并将javau home设置为jdk1.6,然后运行sqoop。

相关问题