We are upgrading our application from spring boot version 2.6.7 to 2.7.0 and we started getting an error on application start up:
java.sql.SQLException: Identity plugin 'AWS-IAM' is used without having AWS SDK in classpath. Please add 'software.amazon.awssdk:rds' to classpath
We already have the below dependency added:
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk-rds</artifactId>
<version>1.12.221</version>
</dependency>
No other changes were made in the code. Any ideas on how to fix this?
Stacktrace:
java.sql.SQLException: Identity plugin 'AWS-IAM' is used without having AWS SDK in classpath. Please add 'software.amazon.awssdk:rds' to classpath
at org.mariadb.jdbc.plugin.credential.aws.AwsIamCredentialPlugin.initialize(AwsIamCredentialPlugin.java:58)
at org.mariadb.jdbc.client.impl.ConnectionHelper.loadCredential(ConnectionHelper.java:340)
at org.mariadb.jdbc.client.impl.StandardClient.<init>(StandardClient.java:175)
at org.mariadb.jdbc.Driver.connect(Driver.java:64)
at org.mariadb.jdbc.Driver.connect(Driver.java:83)
at org.mariadb.jdbc.Driver.connect(Driver.java:27)
at com.zaxxer.hikari.util.DriverDataSource.getConnection(DriverDataSource.java:138)
at com.zaxxer.hikari.pool.PoolBase.newConnection(PoolBase.java:364)
at com.zaxxer.hikari.pool.PoolBase.newPoolEntry(PoolBase.java:206)
at com.zaxxer.hikari.pool.HikariPool.createPoolEntry(HikariPool.java:476)
at com.zaxxer.hikari.pool.HikariPool.checkFailFast(HikariPool.java:561)
at com.zaxxer.hikari.pool.HikariPool.<init>(HikariPool.java:115)
at com.zaxxer.hikari.HikariDataSource.getConnection(HikariDataSource.java:112)
at liquibase.integration.spring.SpringLiquibase.afterPropertiesSet(SpringLiquibase.java:266)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1863)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1800)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:620)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542)
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:322)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208)
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1154)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:908)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:583)
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:147)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:734)
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:408)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:308)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1306)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1295)
CodePudding user response:
Spring Boot 2.7 has upgraded from 2.7.x to 3.0.x of mariadb-java-client
. In 3.0.x, they have made some changes to AwsIamCredentialPlugin
. Previously, it looked for the presence of com.amazonaws.auth.BasicAWSCredentials
but it now looks for software.amazon.awssdk.auth.credentials.AwsBasicCredentials
which is in a different module.
As the exception message suggests, adding a dependency on software.amazon.awssdk:rds
should fix the problem. 2.17.199 is the latest version at the time of writing:
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>rds</artifactId>
<version>2.17.199</version>
</dependency>