Я использую AWS SDK для java в своем проекте и теперь хочу использовать диспетчер секретов AWS для хранения данных RDS. при интеграции aws-secretsmanager-jdbc
, получая приведенную ниже ошибку при выполнении запроса к базе данных:
java.lang.NoSuchFieldError: SERVICE_ID
at com.amazonaws.services.secretsmanager.AWSSecretsManagerClient.executeDescribeSecret(AWSSecretsManagerClient.java:885)
at com.amazonaws.services.secretsmanager.AWSSecretsManagerClient.describeSecret(AWSSecretsManagerClient.java:866)
at com.amazonaws.secretsmanager.caching.cache.SecretCacheItem.executeRefresh(SecretCacheItem.java:102)
at com.amazonaws.secretsmanager.caching.cache.SecretCacheItem.executeRefresh(SecretCacheItem.java:32)
at com.amazonaws.secretsmanager.caching.cache.SecretCacheObject.refresh(SecretCacheObject.java:188)
at com.amazonaws.secretsmanager.caching.cache.SecretCacheObject.getSecretValue(SecretCacheObject.java:286)
at com.amazonaws.secretsmanager.caching.SecretCache.getSecretString(SecretCache.java:123)
at com.amazonaws.secretsmanager.sql.AWSSecretsManagerDriver.connectWithSecret(AWSSecretsManagerDriver.java:321)
at com.amazonaws.secretsmanager.sql.AWSSecretsManagerDriver.connect(AWSSecretsManagerDriver.java:384)
at com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:175)
at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:220)
at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:206)
at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.acquireResource(C3P0PooledConnectionPool.java:203)
at com.mchange.v2.resourcepool.BasicResourcePool.doAcquire(BasicResourcePool.java:1138)
at com.mchange.v2.resourcepool.BasicResourcePool.doAcquireAndDecrementPendingAcquiresWithinLockOnSuccess(BasicResourcePool.java:1125)
at com.mchange.v2.resourcepool.BasicResourcePool.access$700(BasicResourcePool.java:44)
at com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask.run(BasicResourcePool.java:1870)
at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:696)
Я провел некоторое исследование и обнаружил, что это может быть проблемой конфликта версий между sdk-core
и secretsmanager
. Вот дерево зависимостей maven:
[INFO] | +- software.amazon.awssdk:secretsmanager:jar:2.10.30:compile
[INFO] | | +- software.amazon.awssdk:aws-json-protocol:jar:2.10.30:compile
[INFO] | | +- software.amazon.awssdk:protocol-core:jar:2.10.30:compile
[INFO] | | +- software.amazon.awssdk:sdk-core:jar:2.10.30:compile
[INFO] | | | \- software.amazon.awssdk:profiles:jar:2.10.30:compile
[INFO] | | +- software.amazon.awssdk:auth:jar:2.10.30:compile
[INFO] | | +- software.amazon.awssdk:http-client-spi:jar:2.10.30:compile
[INFO] | | +- software.amazon.awssdk:regions:jar:2.10.30:compile
[INFO] | | +- software.amazon.awssdk:annotations:jar:2.10.30:compile
[INFO] | | +- software.amazon.awssdk:utils:jar:2.10.30:compile
[INFO] | | +- software.amazon.awssdk:aws-core:jar:2.10.30:compile
[INFO] | | +- software.amazon.awssdk:apache-client:jar:2.10.30:runtime
[INFO] | | \- software.amazon.awssdk:netty-nio-client:jar:2.10.30:runtime
[INFO] +- com.amazonaws.secretsmanager:aws-secretsmanager-jdbc:jar:1.0.3:compile
[INFO] | +- com.amazonaws.secretsmanager:aws-secretsmanager-caching-java:jar:1.0.0:compile
[INFO] | +- com.amazonaws:aws-java-sdk-secretsmanager:jar:1.11.418:compile
[INFO] | | +- com.amazonaws:aws-java-sdk-core:jar:1.11.281:compile
[INFO] | | \- com.amazonaws:jmespath-java:jar:1.11.281:compile
[INFO] +- software.amazon.awssdk:secretsmanager:jar:2.10.30:compile
[INFO] | +- software.amazon.awssdk:aws-json-protocol:jar:2.10.30:compile
[INFO] | +- software.amazon.awssdk:protocol-core:jar:2.10.30:compile
[INFO] | +- software.amazon.awssdk:sdk-core:jar:2.10.30:compile
[INFO] | | \- software.amazon.awssdk:profiles:jar:2.10.30:compile
[INFO] | +- software.amazon.awssdk:auth:jar:2.10.30:compile
[INFO] | +- software.amazon.awssdk:http-client-spi:jar:2.10.30:compile
[INFO] | +- software.amazon.awssdk:regions:jar:2.10.30:compile
[INFO] | +- software.amazon.awssdk:annotations:jar:2.10.30:compile
[INFO] | +- software.amazon.awssdk:utils:jar:2.10.30:compile
[INFO] | +- software.amazon.awssdk:aws-core:jar:2.10.30:compile
[INFO] | +- software.amazon.awssdk:apache-client:jar:2.10.30:runtime
[INFO] | \- software.amazon.awssdk:netty-nio-client:jar:2.10.30:runtime
[INFO] \- com.amazonaws:aws-java-sdk-s3:jar:1.11.281:compile
[INFO] \- com.amazonaws:aws-java-sdk-kms:jar:1.11.281:compile
К вашему сведению, я использую bom-файл для AWS JAVA SDK, который имеет версию 2.5.47 , тогда как aws-secretsmanager-jdbc
have AWS JAVA SDK версия 1.11.418
Я пытаюсь использовать AWS оболочку для соединения с базой данных AWS Secrets Manager JDB C
Есть идеи, как решить эту проблему?