Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'cloudWatchAsyncClient' threw exception with message: null #948

Closed
rolfhub opened this issue Nov 8, 2023 · 3 comments
Closed

'cloudWatchAsyncClient' threw exception with message: null #948

rolfhub opened this issue Nov 8, 2023 · 3 comments

Comments

@rolfhub
Copy link

rolfhub commented Nov 8, 2023

Type: Bug

Component:
CloudWatch

Describe the bug
Our App runs in AWS ECS with EC2 as capacity provider (Spring Boot 3.1.5, JDK 17). After the update from spring-cloud-aws-starter 3.0.2 to 3.0.3 we get the follwing exception:

Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [software.amazon.awssdk.services.cloudwatch.CloudWatchAsyncClient]: Factory method 'cloudWatchAsyncClient' threw exception with message: null
	at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:171)
	at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:650)
	... 116 common frames omitted
Caused by: java.lang.UnsupportedOperationException: null
	at software.amazon.awssdk.core.SdkServiceClientConfiguration$Builder.authSchemes(SdkServiceClientConfiguration.java:169)
	at software.amazon.awssdk.core.SdkServiceClientConfiguration.<init>(SdkServiceClientConfiguration.java:43)
	at software.amazon.awssdk.awscore.AwsServiceClientConfiguration.<init>(AwsServiceClientConfiguration.java:35)
	at software.amazon.awssdk.services.cloudwatch.CloudWatchServiceClientConfiguration.<init>(CloudWatchServiceClientConfiguration.java:31)
	at software.amazon.awssdk.services.cloudwatch.CloudWatchServiceClientConfiguration.<init>(CloudWatchServiceClientConfiguration.java:29)
	at software.amazon.awssdk.services.cloudwatch.CloudWatchServiceClientConfiguration$BuilderImpl.build(CloudWatchServiceClientConfiguration.java:104)
	at software.amazon.awssdk.services.cloudwatch.DefaultCloudWatchAsyncClientBuilder.initializeServiceClientConfig(DefaultCloudWatchAsyncClientBuilder.java:57)
	at software.amazon.awssdk.services.cloudwatch.DefaultCloudWatchAsyncClientBuilder.buildClient(DefaultCloudWatchAsyncClientBuilder.java:43)
	at software.amazon.awssdk.services.cloudwatch.DefaultCloudWatchAsyncClientBuilder.buildClient(DefaultCloudWatchAsyncClientBuilder.java:28)
	at software.amazon.awssdk.core.client.builder.SdkDefaultClientBuilder.build(SdkDefaultClientBuilder.java:157)
	at io.awspring.cloud.autoconfigure.metrics.CloudWatchExportAutoConfiguration.cloudWatchAsyncClient(CloudWatchExportAutoConfiguration.java:72)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.base/java.lang.reflect.Method.invoke(Unknown Source)
	at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:139)
	... 117 common frames omitted
@maxjiang153
Copy link
Contributor

Would you provide a demo code that can reproduce this issue?

@rolfhub
Copy link
Author

rolfhub commented Nov 13, 2023

The code in this repository produces the same exception when executing ./gradlew test : https://github.com/rolfhub/spring-cloud-aws-948 in DemoApplicationTests. When switching spring-cloud-aws-starter in build.gradle back to 3.0.2 the test runs successfully again.

@maciejwalkowiak
Copy link
Contributor

There is some incompatibility with AWS SDK version you included and Spring Cloud AWS.

I recommend using BOM from Spring Cloud AWS to manage dependencies like this:

dependencies {
  implementation platform("io.awspring.cloud:spring-cloud-aws-dependencies:3.0.3")
  implementation 'io.awspring.cloud:spring-cloud-aws-starter'
  implementation 'io.micrometer:micrometer-registry-cloudwatch2'
}

With this change, your example works as expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants