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

Spring cloud aws startup failed #934

Closed
maxjiang153 opened this issue Nov 2, 2023 · 1 comment · Fixed by #955
Closed

Spring cloud aws startup failed #934

maxjiang153 opened this issue Nov 2, 2023 · 1 comment · Fixed by #955
Labels
component: core Core functionality related issue type: bug Something isn't working
Milestone

Comments

@maxjiang153
Copy link
Contributor

Type: Bug

Component:
spring-cloud-aws-starter

Describe the bug
When only using spring-cloud-aws-starter to manage aws credential, it will fail to start and show the exception below:

15:52:47.883 [main] ERROR org.springframework.boot.SpringApplication -- Application run failed
java.lang.IllegalArgumentException: Unable to instantiate factory class [io.awspring.cloud.autoconfigure.config.parameterstore.ParameterStoreConfigDataLocationResolver] for factory type [org.springframework.boot.context.config.ConfigDataLocationResolver]
	at org.springframework.core.io.support.SpringFactoriesLoader$FailureHandler.lambda$throwing$0(SpringFactoriesLoader.java:651)
	at org.springframework.core.io.support.SpringFactoriesLoader$FailureHandler.lambda$handleMessage$3(SpringFactoriesLoader.java:675)
	at org.springframework.core.io.support.SpringFactoriesLoader.instantiateFactory(SpringFactoriesLoader.java:231)
	at org.springframework.core.io.support.SpringFactoriesLoader.load(SpringFactoriesLoader.java:206)
	at org.springframework.core.io.support.SpringFactoriesLoader.load(SpringFactoriesLoader.java:160)
	at org.springframework.boot.context.config.ConfigDataLocationResolvers.<init>(ConfigDataLocationResolvers.java:66)
	at org.springframework.boot.context.config.ConfigDataEnvironment.createConfigDataLocationResolvers(ConfigDataEnvironment.java:160)
	at org.springframework.boot.context.config.ConfigDataEnvironment.<init>(ConfigDataEnvironment.java:148)
	at org.springframework.boot.context.config.ConfigDataEnvironmentPostProcessor.getConfigDataEnvironment(ConfigDataEnvironmentPostProcessor.java:101)
	at org.springframework.boot.context.config.ConfigDataEnvironmentPostProcessor.postProcessEnvironment(ConfigDataEnvironmentPostProcessor.java:96)
	at org.springframework.boot.context.config.ConfigDataEnvironmentPostProcessor.postProcessEnvironment(ConfigDataEnvironmentPostProcessor.java:89)
	at org.springframework.boot.env.EnvironmentPostProcessorApplicationListener.onApplicationEnvironmentPreparedEvent(EnvironmentPostProcessorApplicationListener.java:109)
	at org.springframework.boot.env.EnvironmentPostProcessorApplicationListener.onApplicationEvent(EnvironmentPostProcessorApplicationListener.java:94)
	at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:174)
	at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:167)
	at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:145)
	at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:133)
	at org.springframework.boot.context.event.EventPublishingRunListener.multicastInitialEvent(EventPublishingRunListener.java:136)
	at org.springframework.boot.context.event.EventPublishingRunListener.environmentPrepared(EventPublishingRunListener.java:81)
	at org.springframework.boot.SpringApplicationRunListeners.lambda$environmentPrepared$2(SpringApplicationRunListeners.java:64)
	at java.base/java.lang.Iterable.forEach(Iterable.java:75)
	at org.springframework.boot.SpringApplicationRunListeners.doWithListeners(SpringApplicationRunListeners.java:118)
	at org.springframework.boot.SpringApplicationRunListeners.doWithListeners(SpringApplicationRunListeners.java:112)
	at org.springframework.boot.SpringApplicationRunListeners.environmentPrepared(SpringApplicationRunListeners.java:63)
	at org.springframework.boot.SpringApplication.prepareEnvironment(SpringApplication.java:360)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:311)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1306)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1295)
	at com.amazonaws.springcloudawscredentials.SpringCloudAwsCredentialsExampleApplication.main(SpringCloudAwsCredentialsExampleApplication.java:10)
Caused by: java.lang.NoClassDefFoundError: software/amazon/awssdk/awscore/client/builder/AwsClientBuilder
	at java.base/java.lang.Class.getDeclaredConstructors0(Native Method)
	at java.base/java.lang.Class.privateGetDeclaredConstructors(Class.java:3373)
	at java.base/java.lang.Class.getConstructors(Class.java:2060)
	at org.springframework.core.io.support.SpringFactoriesLoader$FactoryInstantiator.findConstructor(SpringFactoriesLoader.java:405)
	at org.springframework.core.io.support.SpringFactoriesLoader$FactoryInstantiator.forClass(SpringFactoriesLoader.java:394)
	at org.springframework.core.io.support.SpringFactoriesLoader.instantiateFactory(SpringFactoriesLoader.java:227)
	... 26 common frames omitted
Caused by: java.lang.ClassNotFoundException: software.amazon.awssdk.awscore.client.builder.AwsClientBuilder
	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641)
	at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520)
	... 32 common frames omitted

Sample

Using only two dependencies with Spring Boot 3.1.5 will reproduce this issue

	<dependencies>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-web</artifactId>
		</dependency>

		<dependency>
			<groupId>io.awspring.cloud</groupId>
			<artifactId>spring-cloud-aws-starter</artifactId>
			<version>3.0.2</version>
		</dependency>
	</dependencies>
@maxjiang153 maxjiang153 mentioned this issue Nov 2, 2023
9 tasks
@maciejwalkowiak maciejwalkowiak added type: bug Something isn't working component: core Core functionality related issue labels Nov 6, 2023
@maciejwalkowiak maciejwalkowiak added this to the 3.0.4 milestone Nov 6, 2023
maciejwalkowiak added a commit that referenced this issue Nov 15, 2023
…rtup when only base starter is included in classpath.

Fixes #934
@maciejwalkowiak
Copy link
Contributor

Fix is coming. As a temporary workaround, you can add explicit dependency to aws-core:

<dependency>
	<groupId>software.amazon.awssdk</groupId>
	<artifactId>aws-core</artifactId>
	<version>2.20.109</version>
</dependency>

maciejwalkowiak added a commit that referenced this issue Dec 1, 2023
…rtup when only base starter is included in classpath. (#955)

Fixes #934
@maciejwalkowiak maciejwalkowiak modified the milestones: 3.0.4, 3.1.0 Dec 9, 2023
maciejwalkowiak added a commit that referenced this issue Dec 10, 2023
…rtup when only base starter is included in classpath. (#955)

Fixes #934
maciejwalkowiak added a commit that referenced this issue Dec 10, 2023
…rtup when only base starter is included in classpath. (#955)

Fixes #934
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: core Core functionality related issue type: bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants