Created on 03-10-2019 09:10 PM - edited 09-16-2022 07:13 AM
I run a PC with Ubuntu 16.04 LTS. I have installed CDH 5.16.1 (installation by parcels) and had accidentally allowed it to install Oracle Java 7 into my default Java directory (/usr/lib/jvm). Prior to my CDH installation I had installed OpenJDK 8 on my PC in the same location.
I then downloaded the JDBC for Postgresql for Java 8 and higher postgresql-42.2.5.jar and placed it in the recommended directory (/var/lib/sqoop).
In attempting to connect to my database and list the tables present, I got the following error:
Exception in thread "main" java.lang.UnsupportedClassVersionError: org/postgresql/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.CatalogQueryManager.listTables(CatalogQueryManager.java:102)
at org.apache.sqoop.tool.ListTablesTool.run(ListTablesTool.java:49)
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)
I understand that it points to a conflict in the JDK versions that are present in my PC. I then replaced the JDBC with postgresql-42.2.5.jre7.jar but still received the same error.
I then changed the Java Home Directory on Cloudera Manager to that of my OpenJDK 8, followed up with replacing the JDBC once again with postgresql-42.2.5.jar in the same location, but the error remains.
I have checked if it were possible that the error may be with Sqoop, and have removed the JDBC driver from /var/lib/sqoop, but I receive the same error.
Please help.
Created 03-11-2019 03:45 PM
This error is more related to the java version currently running on your host. Check that you are running java version 8, and ensure your JAVA_HOME environment variable is set to this location.
Created 03-11-2019 03:45 PM
This error is more related to the java version currently running on your host. Check that you are running java version 8, and ensure your JAVA_HOME environment variable is set to this location.
Created 05-09-2019 06:47 PM
My apologies for the delay. I was occupied with an urgent, unrelated project.
I have used your advice and Sqoop works fine now. Thank you.
Created on 05-10-2019 01:52 PM - edited 05-10-2019 01:55 PM
@Tipo33 Thanks for letting us know you solved your issue. If you could mark the reply as the solution it would help others in a similar situation find it in the future.
Created 06-19-2019 01:12 PM
Hello Tipo33
Could you please tell me how you solved this issue ...
I'm having the same problem without finding a solution...
Created 11-10-2019 05:27 PM
I had to install Java 8 and set JAVA_HOME to this