2013-05-22 147 views
2

我試圖使用sqoop將表格從MySQL導入到HDFS。 使用的命令行是,Sqoop導入失敗,UnsupportedClassVersionError

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 

該映射器將失敗,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 : [email protected] 
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_21,sqoop:Sqoop 1.4.1-cdh4.1.3(GIT提交ID 0ff32b245c1d4c75e9f034414ebd8cfcdd140e7e)

回答

1

的MAJOR.MINOR 51.0版本JDK代表1.7這也印證你說什麼。看來,JDK 1.7與Sqoop版本1.4.1-cdh4.1.3不兼容。根據此supported JDK requirements for CDH4,CDH 4.2及更高版本支持JDK 1.7。

安裝並使用Oracle JDK Installation將JAVA_HOME設置爲JDK 1.6,然後運行sqoop。

1

我在Sqoop在JDK7上運行而Hadoop羣集在JDK6上時看到過這個問題。確保所有的Java應用程序都使用相同的主要JDK版本,你應該沒問題。

-1

我將$ JAVA_HOME更改爲默認情況下Cloudera Manager安裝的j2sdk1.6-oracle。然後我導出PATH變量來包含bin並且它工作。