sqoop导入错误:unsupportedclassversionerror cdh 5.16

8hhllhi2  于 2021-05-29  发布在  Hadoop
关注(0)|答案(1)|浏览(284)

我在跑步 CDH 5.16rhel7 系统。我安装了 CDH using packages .
当我想跑的时候 Sqoop 从位于远程服务器中的mysql服务器导入作业时,出现以下错误:

Warning: /usr/lib/sqoop/../accumulo does not exist! Accumulo imports will fail.
Please set $ACCUMULO_HOME to the root of your Accumulo installation.
19/06/03 18:39:43 INFO sqoop.Sqoop: Running Sqoop version: 1.4.6-cdh5.16.1
19/06/03 18:39:43 WARN tool.BaseSqoopTool: Setting your password on the command-line is insecure. Consider using -P instead.
19/06/03 18:39:43 INFO manager.MySQLManager: Preparing to use a MySQL streaming resultset.
19/06/03 18:39:43 INFO tool.CodeGenTool: Beginning code generation
Exception in thread "main" java.lang.UnsupportedClassVersionError: com/mysql/jdbc/Driver : Unsupported major.minor version 52.0
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
        at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
        at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
        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)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:190)
        at org.apache.sqoop.manager.SqlManager.makeConnection(SqlManager.java:872)
        at org.apache.sqoop.manager.GenericJdbcManager.getConnection(GenericJdbcManager.java:52)
        at org.apache.sqoop.manager.SqlManager.execute(SqlManager.java:762)
        at org.apache.sqoop.manager.SqlManager.execute(SqlManager.java:785)
        at org.apache.sqoop.manager.SqlManager.getColumnInfoForRawQuery(SqlManager.java:288)
        at org.apache.sqoop.manager.SqlManager.getColumnTypesForRawQuery(SqlManager.java:259)
        at org.apache.sqoop.manager.SqlManager.getColumnTypes(SqlManager.java:245)
        at org.apache.sqoop.manager.ConnManager.getColumnTypes(ConnManager.java:333)
        at org.apache.sqoop.orm.ClassWriter.getColumnTypes(ClassWriter.java:1858)
        at org.apache.sqoop.orm.ClassWriter.generate(ClassWriter.java:1657)
        at org.apache.sqoop.tool.CodeGenTool.generateORM(CodeGenTool.java:106)
        at org.apache.sqoop.tool.ImportTool.importTable(ImportTool.java:494)
        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)

这是我的sqoop导入语句: sqoop import --connect jdbc:mysql://10.188.177.228:3306/sales --username vaishak --password root_123 --table categories --m 1 --target-dir /user/hive/warehouse/sales.db/categories 我的java版本是:

openjdk version "1.8.0_212"
OpenJDK Runtime Environment (build 1.8.0_212-b04)
OpenJDK 64-Bit Server VM (build 25.212-b04, mixed mode)

这是在cloudera manager安装期间安装的java。
我浏览了下面的stackoverflow链接,在这种情况下没有多大帮助:sqoop导入失败,unsupportedclassversionerror
在cdh之前,我已经分别安装了hadoopversion3和sqoop(在cdh之外),并且能够成功地运行sqoop脚本。
但我无法理解这里的问题。我也找不到 HADOOP_PREFIX , JAVA_HOME 路径。
我已经下载并放置了mysql连接器 mysql-connector-java-8.0.13.jar/usr/lib/sqoop/lib 开始import语句之前的路径。
我对设置hadoop组件很陌生,尤其是使用cdh。

kg7wmglp

kg7wmglp1#

找到问题了!。似乎安装了两个版本的java。我删除了旧版本的java,现在一切都开始正常了!

相关问题