aws/aws-secretsmanager-jdbc

spring-boot Hikari compatibility

Closed this issue · 3 comments

Does this work with spring-boot defaults (Hikari connection pool)? I have tried

spring.datasource.url = jdbc-secretsmanager:postgresql://localhost:5432/test_db
spring.datasource.driver-class-name = com.amazonaws.secretsmanager.sql.AWSSecretsManagerPostgreSQLDriver
spring.datasource.username = testSecret

but I get

    Failed to bind properties under '' to com.zaxxer.hikari.HikariDataSource:

        Property: driverclassname
        Value: com.amazonaws.secretsmanager.sql.AWSSecretsManagerPostgreSQLDriver
        Origin: "driverClassName" from property source "source"
        Reason: Could not initialize class com.amazonaws.secretsmanager.sql.AWSSecretsManagerPostgreSQLDriver

    Action:

    Update your application's configuration

root cause is

    Caused by: java.lang.NoClassDefFoundError: Could not initialize class com.amazonaws.secretsmanager.sql.AWSSecretsManagerPostgreSQLDriver
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:1.8.0_202]
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[na:1.8.0_202]
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[na:1.8.0_202]
        at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[na:1.8.0_202]
        at java.lang.Class.newInstance(Class.java:442) ~[na:1.8.0_202]
        at com.zaxxer.hikari.HikariConfig.setDriverClassName(HikariConfig.java:501) ~[HikariCP-3.2.0.jar:na]
        ... 141 common frames omitted

Works fine for me. Can you publish sample application that's failing for you?

We decided not to use this library because of that error. We can close this if nobody else is seeing the error

I had the same problem while running it locally, but running on AWS there are no issues.
If you want to run it locally, you have to set the environment variablesAWS_PROFILE and AWS_REGION.