micronaut-projects / micronaut-jms

Integration between Micronaut and JMS
Apache License 2.0
14 stars 14 forks source link

Version 3.1.0 is incompatible with Micronaut 4.2.x #472

Closed oliverblaha closed 8 months ago

oliverblaha commented 8 months ago

Expected Behavior

Consistent AWS SDK should be used between Micronaut and its referenced version of micronaut-jms.

Actual Behaviour

Different versions of the AWS SDK are used, which leads to errors:

[...] Caused by: java.lang.NoClassDefFoundError: software/amazon/awssdk/protocols/query/interceptor/QueryParametersToBodyInterceptor
    at software.amazon.awssdk.services.sns.DefaultSnsBaseClientBuilder.finalizeServiceConfiguration(DefaultSnsBaseClientBuilder.java:73)
    at software.amazon.awssdk.awscore.client.builder.AwsDefaultClientBuilder.finalizeChildConfiguration(AwsDefaultClientBuilder.java:185)
    at software.amazon.awssdk.core.client.builder.SdkDefaultClientBuilder.syncClientConfiguration(SdkDefaultClientBuilder.java:193)
    at software.amazon.awssdk.services.sns.DefaultSnsClientBuilder.buildClient(DefaultSnsClientBuilder.java:39)
    at software.amazon.awssdk.services.sns.DefaultSnsClientBuilder.buildClient(DefaultSnsClientBuilder.java:28)
    at software.amazon.awssdk.core.client.builder.SdkDefaultClientBuilder.build(SdkDefaultClientBuilder.java:157)
    at io.micronaut.aws.sdk.v2.service.AwsClientFactory.syncClient(AwsClientFactory.java:110)
    at io.micronaut.aws.sdk.v2.service.sns.SnsClientFactory.syncClient(SnsClientFactory.java:80)
    at io.micronaut.aws.sdk.v2.service.sns.$SnsClientFactory$SyncClient1$Definition.instantiate(Unknown Source)
    at io.micronaut.context.DefaultBeanContext.resolveByBeanFactory(DefaultBeanContext.java:2309)
    ... 124 more

Steps To Reproduce

No response

Environment Information

No response

Example Application

No response

Version

4.2.3

oliverblaha commented 8 months ago

@sdelamo Any plans for a release anytime soon?

sdelamo commented 8 months ago

let me check @oliverblaha do you have a sample app?

sdelamo commented 8 months ago

Please note https://github.com/micronaut-projects/micronaut-jms/releases/tag/v3.1.0 will be added to the Micronaut Framework 4.3.0 BOM which is not yet released.

Micronaut Framework 4.2.3 works with JMS 3.0.1.

oliverblaha commented 8 months ago

@sdelamo It looks like Micronaut 4.2.x already uses 3.1.0, at least that's what it pulls by default. Micronaut 4.1.x indeed still uses 3.0.1.

sdelamo commented 8 months ago

my bad @oliverblaha you are right. let me understand what's going on.

sdelamo commented 8 months ago

@oliverblaha forcing the software.amazon.awssdk:sqs dependency to 2.21.15 should work. For example, with gradle:

configurations.all {
    resolutionStrategy {
        force("software.amazon.awssdk:sqs:2.21.15")
    }
}
oliverblaha commented 8 months ago

Thanks @sdelamo, the workaround isn't really working when using renovate though. We'll probably just be waiting for the 4.3.0 release instead. But maybe there's a way to catch this in some test case before it happens again?

oliverblaha commented 8 months ago

btw, seems it was already reported earlier, but remained unnoticed: https://github.com/micronaut-projects/micronaut-platform/issues/1133

sdelamo commented 8 months ago

Thanks @sdelamo, the workaround isn't really working when using renovate though. We'll probably just be waiting for the 4.3.0 release instead. But maybe there's a way to catch this in some test case before it happens again?

what do you mean by when using renovate?

oliverblaha commented 8 months ago

We're using renovate to auto-update dependencies; manually forcing a version for AWS defeats the purpose of automatic updates.

sdelamo commented 8 months ago

I created a demo application with 4.2.3 and Micronaut JMS SQS, and I am not able to replicate the error @oliverblaha

https://github.com/sdelamo/demo-micronaut-sqs

Do you know what I am missing?

oliverblaha commented 8 months ago

@sdelamo This particular conflict shows when injecting a bean of type SnsClient. I've raised a PR with a minimal example for your demo project.

sdelamo commented 8 months ago

@oliverblaha thanks for reporting and helping me work through this issue. This is fixed in Micronaut Framework 4.2.4.