aws / amazon-redshift-jdbc-driver

Redshift JDBC Driver. It supports JDBC 4.2 specification.
Apache License 2.0
63 stars 31 forks source link

Drivers still requires classes from AWS SDK v1 for IAM identification #120

Open NathanEckert opened 4 months ago

NathanEckert commented 4 months ago

Driver version

2.1.0.29

Redshift version

Client Operating System

Linux Ubuntu 22.04.4 LTS

JAVA/JVM version

openjdk 21.0.3 2024-04-16 LTS OpenJDK Runtime Environment Temurin-21.0.3+9 (build 21.0.3+9-LTS) OpenJDK 64-Bit Server VM Temurin-21.0.3+9 (build 21.0.3+9-LTS, mixed mode, sharing)

Problem description

When migrating to AWS SDK v2 following the end-of-support announcement (https://aws.amazon.com/blogs/developer/announcing-end-of-support-for-aws-sdk-for-java-v1-x-on-december-31-2025/), I noticed that the JDBC driver still requires one Java SDK v1 class when using IAM

Reproduction code

I tried to remove from my pom the following artifact

<dependency>
  <groupId>com.amazonaws</groupId>
  <artifactId>aws-java-sdk-redshift</artifactId>
</dependency>

I even tried to replace it with the v2 version:

<dependency>
   <groupId>software.amazon.awssdk</groupId>
  <artifactId>redshift</artifactId>
</dependency>

But when running code using IAM identification, I get the following stacktrace:

java.lang.NoClassDefFoundError: com/amazonaws/auth/AWSCredentials

    at com.amazon.redshift.jdbc.RedshiftConnectionImpl.<init>(RedshiftConnectionImpl.java:284)
    at com.amazon.redshift.Driver.makeConnection(Driver.java:483)
    at com.amazon.redshift.Driver.connect(Driver.java:304)
brianwyka commented 2 months ago

I just noticed the same thing.

ShuuyaMonzen commented 2 months ago

I have the same problem. My project is a Java17, Gradle-based project

matt-brewster commented 1 week ago

I'm getting a slightly different error but I think it's the same root cause:

java.lang.NoClassDefFoundError: com/amazonaws/services/redshift/AmazonRedshiftClientBuilder
    at com.amazon.redshift.jdbc.RedshiftConnectionImpl.<init>(RedshiftConnectionImpl.java:287) ~[redshift-jdbc42-2.1.0.30.jar:na]
    at com.amazon.redshift.Driver.makeConnection(Driver.java:483) ~[redshift-jdbc42-2.1.0.30.jar:na]
    at com.amazon.redshift.Driver.connect(Driver.java:304) ~[redshift-jdbc42-2.1.0.30.jar:na]