2
votes

I am running CDH 5.16 on a rhel7 system. I installed CDH using packages.

When I am trying to run Sqoop import job from MySQL Server located in a remote server, I am getting following error:

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) 

This is my sqoop import statement:

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

my java version is :

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)

This is the java that is installed during Cloudera manager installation.

I went through the following stackoverflow link and wasn't much helpfull in this case: Sqoop import failed, UnsupportedClassVersionError

Before CDH, I had setup Hadoop version 3 along with sqoop separately(outside CDH) and was able to run sqoop scripts successfully.

But i am unable to figure out the issue here. I am also unable to find out the HADOOP_PREFIX, JAVA_HOME path.

I have downloaded and placed mysql connector mysql-connector-java-8.0.13.jar in /usr/lib/sqoop/lib path before starting import statement.

I am new to Setting up Hadoop Components especially using CDH.

1
The error is saying Java 8 is not supported. Nothing to do strictly with Hadoop or Sqoop. You might want to verify which versions of Java that CDH 5.16 works withOneCricketeer
As per cloudera documentation, 5.16 and higher releases support Java 8.cloudera link:cloudera.com/documentation/enterprise/6/release-notes/topics/… . This is the reason why i am also confused. Java version is supported by CDH. Not sure why this error is cropping up now.Vaishak
@cricket_007 Do you think this error has something to do with the sql connector used?Vaishak
It's possible. I'd be surprised if the driver you have was only for Java 7, thoughOneCricketeer
its not the problem with the driver. The driver does support java 1.8. Unable to figure out whats causing this now...Vaishak

1 Answers

0
votes

Found the issue!. It seems like there were two versions of java that were installed. I removed the older version of java and things started working now!