micronaut-projects / micronaut-aws

Projects specific to integrating Micronaut and Amazon Web Services (AWS)
Apache License 2.0
87 stars 80 forks source link

Leaking apache commons-logging still #1203

Open dkowis opened 3 years ago

dkowis commented 3 years ago

Expected Behavior

I should not have any commons-logging in my runtime classpath, unfortunately, I do.

Actual Behaviour

I found issue/PR: #187 / #189, but it doesn't seem to cover all the things. Like, using the sts client still pulls in commons-logging, which makes everything upset in native-image land.

checking my dependencies,

    implementation("io.micronaut.aws:micronaut-aws-sdk-v2")
    implementation("software.amazon.awssdk:ssm")
    implementation("software.amazon.awssdk:sts")
expand for the tree ``` +--- io.micronaut.aws:micronaut-aws-sdk-v2 -> 3.0.1 | +--- io.micronaut:micronaut-bom:3.0.3 -> 3.1.0 (*) | +--- software.amazon.awssdk:bom:2.16.104 | | +--- software.amazon.awssdk:ssm:2.16.104 (c) | | +--- software.amazon.awssdk:sts:2.16.104 (c) | | +--- software.amazon.awssdk:aws-json-protocol:2.16.104 (c) | | +--- software.amazon.awssdk:protocol-core:2.16.104 (c) | | +--- software.amazon.awssdk:sdk-core:2.16.104 (c) | | +--- software.amazon.awssdk:auth:2.16.104 (c) | | +--- software.amazon.awssdk:http-client-spi:2.16.104 (c) | | +--- software.amazon.awssdk:regions:2.16.104 (c) | | +--- software.amazon.awssdk:annotations:2.16.104 (c) | | +--- software.amazon.awssdk:utils:2.16.104 (c) | | +--- software.amazon.awssdk:aws-core:2.16.104 (c) | | +--- software.amazon.awssdk:metrics-spi:2.16.104 (c) | | +--- software.amazon.awssdk:apache-client:2.16.104 (c) | | +--- software.amazon.awssdk:netty-nio-client:2.16.104 (c) | | +--- software.amazon.awssdk:aws-query-protocol:2.16.104 (c) | | \--- software.amazon.awssdk:profiles:2.16.104 (c) | \--- io.micronaut.aws:micronaut-aws-common:3.0.1 | +--- io.micronaut:micronaut-bom:3.0.3 -> 3.1.0 (*) | \--- io.micronaut:micronaut-inject:3.0.3 -> 3.1.0 (*) +--- software.amazon.awssdk:ssm -> 2.16.104 | +--- software.amazon.awssdk:aws-json-protocol:2.16.104 | | +--- software.amazon.awssdk:aws-core:2.16.104 | | | +--- software.amazon.awssdk:annotations:2.16.104 | | | +--- software.amazon.awssdk:regions:2.16.104 | | | | +--- software.amazon.awssdk:annotations:2.16.104 | | | | +--- software.amazon.awssdk:utils:2.16.104 | | | | | +--- org.reactivestreams:reactive-streams:1.0.3 | | | | | +--- software.amazon.awssdk:annotations:2.16.104 | | | | | \--- org.slf4j:slf4j-api:1.7.30 | | | | +--- software.amazon.awssdk:sdk-core:2.16.104 | | | | | +--- software.amazon.awssdk:annotations:2.16.104 | | | | | +--- software.amazon.awssdk:http-client-spi:2.16.104 | | | | | | +--- software.amazon.awssdk:annotations:2.16.104 | | | | | | +--- software.amazon.awssdk:utils:2.16.104 (*) | | | | | | +--- software.amazon.awssdk:metrics-spi:2.16.104 | | | | | | | +--- software.amazon.awssdk:annotations:2.16.104 | | | | | | | \--- software.amazon.awssdk:utils:2.16.104 (*) | | | | | | \--- org.reactivestreams:reactive-streams:1.0.3 | | | | | +--- software.amazon.awssdk:metrics-spi:2.16.104 (*) | | | | | +--- software.amazon.awssdk:utils:2.16.104 (*) | | | | | +--- software.amazon.awssdk:profiles:2.16.104 | | | | | | +--- software.amazon.awssdk:utils:2.16.104 (*) | | | | | | \--- software.amazon.awssdk:annotations:2.16.104 | | | | | +--- org.slf4j:slf4j-api:1.7.30 | | | | | +--- com.fasterxml.jackson.core:jackson-core:2.12.3 -> 2.12.4 (*) | | | | | +--- com.fasterxml.jackson.core:jackson-databind:2.12.3 -> 2.12.4 (*) | | | | | \--- org.reactivestreams:reactive-streams:1.0.3 | | | | +--- software.amazon.awssdk:profiles:2.16.104 (*) | | | | +--- com.fasterxml.jackson.core:jackson-databind:2.12.3 -> 2.12.4 (*) | | | | +--- com.fasterxml.jackson.core:jackson-annotations:2.12.3 -> 2.12.4 (*) | | | | \--- org.slf4j:slf4j-api:1.7.30 | | | +--- software.amazon.awssdk:auth:2.16.104 | | | | +--- software.amazon.awssdk:annotations:2.16.104 | | | | +--- software.amazon.awssdk:utils:2.16.104 (*) | | | | +--- software.amazon.awssdk:sdk-core:2.16.104 (*) | | | | +--- software.amazon.awssdk:regions:2.16.104 (*) | | | | +--- software.amazon.awssdk:profiles:2.16.104 (*) | | | | +--- software.amazon.awssdk:http-client-spi:2.16.104 (*) | | | | +--- com.fasterxml.jackson.core:jackson-databind:2.12.3 -> 2.12.4 (*) | | | | \--- software.amazon.eventstream:eventstream:1.0.1 | | | +--- software.amazon.awssdk:profiles:2.16.104 (*) | | | +--- software.amazon.awssdk:sdk-core:2.16.104 (*) | | | +--- software.amazon.awssdk:http-client-spi:2.16.104 (*) | | | +--- software.amazon.awssdk:metrics-spi:2.16.104 (*) | | | +--- software.amazon.awssdk:utils:2.16.104 (*) | | | +--- org.slf4j:slf4j-api:1.7.30 | | | \--- software.amazon.eventstream:eventstream:1.0.1 | | +--- software.amazon.awssdk:protocol-core:2.16.104 | | | +--- software.amazon.awssdk:sdk-core:2.16.104 (*) | | | +--- software.amazon.awssdk:annotations:2.16.104 | | | +--- software.amazon.awssdk:utils:2.16.104 (*) | | | \--- software.amazon.awssdk:http-client-spi:2.16.104 (*) | | +--- software.amazon.awssdk:sdk-core:2.16.104 (*) | | +--- software.amazon.awssdk:annotations:2.16.104 | | +--- software.amazon.awssdk:http-client-spi:2.16.104 (*) | | +--- software.amazon.awssdk:utils:2.16.104 (*) | | \--- com.fasterxml.jackson.core:jackson-core:2.12.3 -> 2.12.4 (*) | +--- software.amazon.awssdk:protocol-core:2.16.104 (*) | +--- software.amazon.awssdk:sdk-core:2.16.104 (*) | +--- software.amazon.awssdk:auth:2.16.104 (*) | +--- software.amazon.awssdk:http-client-spi:2.16.104 (*) | +--- software.amazon.awssdk:regions:2.16.104 (*) | +--- software.amazon.awssdk:annotations:2.16.104 | +--- software.amazon.awssdk:utils:2.16.104 (*) | +--- software.amazon.awssdk:aws-core:2.16.104 (*) | +--- software.amazon.awssdk:metrics-spi:2.16.104 (*) | +--- software.amazon.awssdk:apache-client:2.16.104 | | +--- software.amazon.awssdk:http-client-spi:2.16.104 (*) | | +--- software.amazon.awssdk:metrics-spi:2.16.104 (*) | | +--- software.amazon.awssdk:utils:2.16.104 (*) | | +--- software.amazon.awssdk:annotations:2.16.104 | | +--- org.apache.httpcomponents:httpclient:4.5.13 | | | +--- org.apache.httpcomponents:httpcore:4.4.13 | | | +--- commons-logging:commons-logging:1.2 <----------------------- | | | \--- commons-codec:commons-codec:1.11 | | \--- org.apache.httpcomponents:httpcore:4.4.11 -> 4.4.13 | \--- software.amazon.awssdk:netty-nio-client:2.16.104 ```

Steps To Reproduce

Simply, use the aws integration, and include the ssm client. (sts client also depends on apache-client, but it didn't seem to expand the tree like ssm did.)

Environment Information

Linux, Graalvm 21

❯ java --version
openjdk 11.0.12 2021-07-20
OpenJDK Runtime Environment GraalVM CE 21.2.0 (build 11.0.12+6-jvmci-21.2-b08)
OpenJDK 64-Bit Server VM GraalVM CE 21.2.0 (build 11.0.12+6-jvmci-21.2-b08, mixed mode, sharing)

Example Application

No response

Version

3.1.0

frehov commented 3 years ago

I've opened an issue over at the aws-sdk-v2-java repository asking for an upgrade of the apache httpclient to httpclient5 which should remedy this issue for good since httpclient5 is using SLF4J as a logging facade instead of using commons-logging.

ChaimaaeROUAI commented 2 months ago

I investigated the issue and found that the commons-logging dependency is brought in transitively by several components, including:

I attempted to exclude commons-logging from the relevant dependencies in aws-sdk-v1 , but the commons-logging dependency still persists. Not sure if excluding commons-loggingthis way is feasible.Should we explore migrating to v2 to resolve this?( the issue is still present in v2, but it is at least planned to upgrade the Apache HttpClient to version 5, which uses SLF4J.)