0

I am trying to run a Data Pipeline job in AWS. I added the field "Jdbc Driver Jar Uri" and placed the jar file in my s3 bucket, per instructions here, because it seems "Connector/J" that is installed by AWS Data Pipeline does not work.

I'm using mysql-connector-java-8.0.23 and my mysql database version is the same.

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:808) 
  at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) 
  at java.net.URLClassLoader.defineClass(URLClassLoader.java:443) 
  at java.net.URLClassLoader.access$100(URLClassLoader.java:65) 
  at java.net.URLClassLoader$1.run(URLClassLoader.java:355) 
  at java.net.URLClassLoader$1.run(URLClassLoader.java:349) 
  at java.security.AccessController.doPrivileged(Native Method) 
  at java.net.URLClassLoader.findClass(URLClassLoader.java:348) 
  at java.lang.ClassLoader.loadClass(ClassLoader.java:430) 
  at java.lang.ClassLoader.loadClass(ClassLoader.java:363) 
  at java.lang.Class.forName0(Native Method) 
  at java.lang.Class.forName(Class.java:278) 
  at amazonaws.datapipeline.database.JdbcDriverInitializer.getDriver(JdbcDriverInitializer.java:75) 
  at amazonaws.datapipeline.database.ConnectionFactory.getRdsDatabaseConnection(ConnectionFactory.java:158) 
  at amazonaws.datapipeline.database.ConnectionFactory.getConnection(ConnectionFactory.java:74) 
  at amazonaws.datapipeline.database.ConnectionFactory.getConnectionWithCredentials(ConnectionFactory.java:302) 
  at amazonaws.datapipeline.connector.SqlDataNode.createConnection(SqlDataNode.java:100) 
  at amazonaws.datapipeline.connector.SqlDataNode.getConnection(SqlDataNode.java:94) 
  at amazonaws.datapipeline.connector.SqlDataNode.prepareStatement(SqlDataNode.java:162) 
  at amazonaws.datapipeline.connector.SqlInputConnector.open(SqlInputConnector.java:49) 
  at amazonaws.datapipeline.connector.SqlInputConnector.<init>(SqlInputConnector.java:26) 
  at amazonaws.datapipeline.connector.SqlDataNode.getInputConnector(SqlDataNode.java:79) 
  at amazonaws.datapipeline.activity.copy.SingleThreadedCopyActivity.processAll(SingleThreadedCopyActivity.java:47) 
  at amazonaws.datapipeline.activity.copy.SingleThreadedCopyActivity.runActivity(SingleThreadedCopyActivity.java:35) 
  at amazonaws.datapipeline.activity.CopyActivity.runActivity(CopyActivity.java:22) 
  at amazonaws.datapipeline.objects.AbstractActivity.run(AbstractActivity.java:16) 
  at amazonaws.datapipeline.taskrunner.TaskPoller.executeRemoteRunner(TaskPoller.java:136) 
  at amazonaws.datapipeline.taskrunner.TaskPoller.executeTask(TaskPoller.java:105) 
  at amazonaws.datapipeline.taskrunner.TaskPoller$1.run(TaskPoller.java:81) 
  at private.com.amazonaws.services.datapipeline.poller.PollWorker.executeWork(PollWorker.java:76) 
  at private.com.amazonaws.services.datapipeline.poller.PollWorker.run(PollWorker.java:53) 
  at java.lang.Thread.run(Thread.java:748)

I've looked at this question for a solution, but I wasn't able to figure out how to adapt those answers to solving it in AWS Data Pipeline.

Can someone explain what steps need to be taken to fix this ClassVersion error?

Mark Rotteveel
  • 100,966
  • 191
  • 140
  • 197
topplethepat
  • 531
  • 6
  • 23
  • 1
    You look at the class version numbers mentioned in the exception message of the UnsupportedClassVersionError (which you neglected to include in your question), and then ensure that you use a Java version that actually supports that class version. As an aside, there are also some bytecode manipulation libraries that throw this error when the version is "too old" and doesn't understand class versions of a newer Java version. – Mark Rotteveel May 04 '22 at 17:20
  • thanks, I added the whole error message now. – topplethepat May 04 '22 at 17:32
  • 1
    The _"Unsupported major.minor version 52.0"_ means that `com.mysql.jdbc.Driver` was compiled targeting Java 8. This means that you seem to be running on Java 7 or earlier. I'm not familiar with AWS Data Pipeline, so I don't know how or where you can change the Java version used (if at all). Alternatively, try downgrading to an (older) 5.1.x JDBC driver. – Mark Rotteveel May 04 '22 at 17:38
  • Possibly related, the tutorial you link instructs you to use MySQL Connector/J 5.1.48, not 8.0.23, and even explicitly tells you to get it from the archive, which seems to suggest that mentioning that version is intentional (maybe to avoid exactly the issue you have). – Mark Rotteveel May 04 '22 at 17:39
  • I tried 5.1.48 but it gave a connection error. – topplethepat May 04 '22 at 17:54
  • If 5.1.48 gave a connection error, at least the driver loaded properly. Then it is a matter of identifying what causes that connection error. – Mark Rotteveel May 05 '22 at 08:02

0 Answers0