Support Questions

Find answers, ask questions, and share your expertise

Populating data from mysql to Atlas via Sqoop

avatar
Rising Star

I am trying to populate data from mysql to view in Atlas via Sqoop.

I tried the following link: https://docs.hortonworks.com/HDPDocuments/HDP2/HDP-2.5.3/bk_data-access/content/using_sqoop_to_move_...

I ran the following command: sqoop import --connect jdbc:mysql://localhost:3306/saliva --table saliva_test and it resulted in the following error:

17/02/20 16:13:39 INFO sqoop.Sqoop: Running Sqoop version: 1.4.6
17/02/20 16:13:39 INFO manager.MySQLManager: Preparing to use a MySQL streaming resultset.
17/02/20 16:13:39 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:803)
	at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
	at java.net.URLClassLoader.defineClass(URLClassLoader.java:442)
	at java.net.URLClassLoader.access$100(URLClassLoader.java:64)
	at java.net.URLClassLoader$1.run(URLClassLoader.java:354)
	at java.net.URLClassLoader$1.run(URLClassLoader.java:348)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.net.URLClassLoader.findClass(URLClassLoader.java:347)
	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:195)
	at org.apache.sqoop.manager.SqlManager.makeConnection(SqlManager.java:854)
	at org.apache.sqoop.manager.GenericJdbcManager.getConnection(GenericJdbcManager.java:52)
	at org.apache.sqoop.manager.SqlManager.execute(SqlManager.java:744)
	at org.apache.sqoop.manager.SqlManager.execute(SqlManager.java:767)
	at org.apache.sqoop.manager.SqlManager.getColumnInfoForRawQuery(SqlManager.java:270)
	at org.apache.sqoop.manager.SqlManager.getColumnTypesForRawQuery(SqlManager.java:241)
	at org.apache.sqoop.manager.SqlManager.getColumnTypes(SqlManager.java:227)
	at org.apache.sqoop.manager.ConnManager.getColumnTypes(ConnManager.java:295)
	at org.apache.sqoop.orm.ClassWriter.getColumnTypes(ClassWriter.java:1833)
	at org.apache.sqoop.orm.ClassWriter.generate(ClassWriter.java:1645)
	at org.apache.sqoop.tool.CodeGenTool.generateORM(CodeGenTool.java:107)
	at org.apache.sqoop.tool.ImportTool.importTable(ImportTool.java:478)
	at org.apache.sqoop.tool.ImportTool.run(ImportTool.java:605)
	at org.apache.sqoop.Sqoop.run(Sqoop.java:143)
	at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:70)
	at org.apache.sqoop.Sqoop.runSqoop(Sqoop.java:179)
	at org.apache.sqoop.Sqoop.runTool(Sqoop.java:218)
	at org.apache.sqoop.Sqoop.runTool(Sqoop.java:227)
	at org.apache.sqoop.Sqoop.main(Sqoop.java:236)

Can you kindly suggest how to fix the issue? Thanking you in anticipation.

1 ACCEPTED SOLUTION

avatar

Major.minor version for java 1.8 is 52. And the mysql jar, you are using is incompatible with java1.7, that is why you are seeing this issue.

https://blogs.oracle.com/darcy/entry/source_target_class_file_version

If you cannot upgrade to java 1.8, then you can try to get the java-1.7 compatible mysql connector jar. This should also work.

View solution in original post

6 REPLIES 6

avatar
@Bilal Arshad

What is your java version on your system? This seems like some compatibility issue with your local JDK and the JDK with which java binaries are compiled.

Upgrade your JDK version and this should work.

avatar
Rising Star

@Ayub Khan

I have the following version of java on the system currently:

java version "1.7.0_121" OpenJDK Runtime Environment (IcedTea 2.6.8) (7u121-2.6.8-1ubuntu0.14.04.3) OpenJDK 64-Bit Server VM (build 24.121-b00, mixed mode)

avatar

Major.minor version for java 1.8 is 52. And the mysql jar, you are using is incompatible with java1.7, that is why you are seeing this issue.

https://blogs.oracle.com/darcy/entry/source_target_class_file_version

If you cannot upgrade to java 1.8, then you can try to get the java-1.7 compatible mysql connector jar. This should also work.

avatar

@Bilal Arshad Is this resolved now?

avatar

@Bilal Arshad If this is no more an issue, could you please close this thread?

avatar
Explorer

@apathan  thank you ! this is what I really needed. saved my time .. I had the same error while bringing up the CM UI. had Java 7 before and the jar file wasnt compatible. So updated the Java 8 and it worked like a charm.