Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

Unsupported major.minor version 52.0 in Sqoop 1 while connecting to a Postgres database

avatar
Explorer

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. 

1 ACCEPTED SOLUTION

avatar
Rising Star

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.

View solution in original post

5 REPLIES 5

avatar
Rising Star

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.

avatar
Explorer

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.

avatar
Community Manager

@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. 

 

Screen Shot 2019-05-10 at 4.47.35 PM.png


Cy Jervis, Manager, Community Program
Was your question answered? Make sure to mark the answer as the accepted solution.
If you find a reply useful, say thanks by clicking on the thumbs up button.

avatar
New Contributor

 

Hello Tipo33 
Could you please tell me how you solved this issue ...
I'm having the same problem without finding a solution...

avatar
Explorer

I had to install Java 8 and set JAVA_HOME to this