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

In Native image SpringCloudClientConfiguration.properties file is missing #673

Open
gvart opened this issue Feb 15, 2023 · 17 comments · May be fixed by #856
Open

In Native image SpringCloudClientConfiguration.properties file is missing #673

gvart opened this issue Feb 15, 2023 · 17 comments · May be fixed by #856
Assignees
Labels
component: core Core functionality related issue

Comments

@gvart
Copy link
Contributor

gvart commented Feb 15, 2023

Type: Bug
Component: DynamodDB

Describe the bug
When I was trying to use io.awspring.cloud:spring-cloud-aws-starter-dynamodb starter with a Native Image for an AWS Lambda, application failed to startup due to a missing resource file in the classpath.
Stacktrace:

2023-02-15T11:55:53.707Z ERROR 9 --- [           main] o.s.boot.SpringApplication               : Application run failed
--
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'lambdaFunction': Unsatisfied dependency expressed through constructor parameter 0: Error creating bean with name 'processNoteRequest': Unsatisfied dependency expressed through method 'processNoteRequest' parameter 1: Error creating bean with name 'defaultSaveNoteRequest': Unsatisfied dependency expressed through constructor parameter 0: Error creating bean with name 'dynamoDBTemplate': Unsatisfied dependency expressed through method 'dynamoDBTemplate' parameter 0: Error creating bean with name 'dynamoDbEnhancedClient': Unsatisfied dependency expressed through method 'dynamoDbEnhancedClient' parameter 0: Error creating bean with name 'dynamoDbClient': Unsatisfied dependency expressed through method 'dynamoDbClient' parameter 0: Error creating bean with name 'awsClientBuilderConfigurer': Instantiation of supplied bean failed
at org.springframework.beans.factory.aot.BeanInstanceSupplier.resolveArgument(BeanInstanceSupplier.java:351) ~[na:na]
at org.springframework.beans.factory.aot.BeanInstanceSupplier.resolveArguments(BeanInstanceSupplier.java:271) ~[na:na]
at org.springframework.beans.factory.aot.BeanInstanceSupplier.get(BeanInstanceSupplier.java:206) ~[na:na]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.obtainInstanceFromSupplier(AbstractAutowireCapableBeanFactory.java:1225) ~[application:6.0.4]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.obtainFromSupplier(AbstractAutowireCapableBeanFactory.java:1210) ~[application:6.0.4]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1157) ~[application:6.0.4]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:561) ~[application:6.0.4]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:521) ~[application:6.0.4]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:326) ~[application:6.0.4]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[application:6.0.4]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:324) ~[application:6.0.4]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200) ~[application:6.0.4]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:961) ~[application:6.0.4]
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:915) ~[application:6.0.4]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:584) ~[application:6.0.4]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:146) ~[application:3.0.2]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:730) ~[application:3.0.2]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:432) ~[application:3.0.2]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:308) ~[application:3.0.2]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1302) ~[application:3.0.2]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1291) ~[application:3.0.2]
at com.everynote.perister.Bootstrap.main(Bootstrap.java:10) ~[application:na]
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'processNoteRequest': Unsatisfied dependency expressed through method 'processNoteRequest' parameter 1: Error creating bean with name 'defaultSaveNoteRequest': Unsatisfied dependency expressed through constructor parameter 0: Error creating bean with name 'dynamoDBTemplate': Unsatisfied dependency expressed through method 'dynamoDBTemplate' parameter 0: Error creating bean with name 'dynamoDbEnhancedClient': Unsatisfied dependency expressed through method 'dynamoDbEnhancedClient' parameter 0: Error creating bean with name 'dynamoDbClient': Unsatisfied dependency expressed through method 'dynamoDbClient' parameter 0: Error creating bean with name 'awsClientBuilderConfigurer': Instantiation of supplied bean failed
at org.springframework.beans.factory.aot.BeanInstanceSupplier.resolveArgument(BeanInstanceSupplier.java:351) ~[na:na]
at org.springframework.beans.factory.aot.BeanInstanceSupplier.resolveArguments(BeanInstanceSupplier.java:271) ~[na:na]
at org.springframework.beans.factory.aot.BeanInstanceSupplier.get(BeanInstanceSupplier.java:206) ~[na:na]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.obtainInstanceFromSupplier(AbstractAutowireCapableBeanFactory.java:1225) ~[application:6.0.4]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.obtainFromSupplier(AbstractAutowireCapableBeanFactory.java:1210) ~[application:6.0.4]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1157) ~[application:6.0.4]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:561) ~[application:6.0.4]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:521) ~[application:6.0.4]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:326) ~[application:6.0.4]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[application:6.0.4]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:324) ~[application:6.0.4]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200) ~[application:6.0.4]
at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:254) ~[application:6.0.4]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1405) ~[application:6.0.4]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1325) ~[application:6.0.4]
at org.springframework.beans.factory.aot.BeanInstanceSupplier.resolveArgument(BeanInstanceSupplier.java:334) ~[na:na]
... 21 common frames omitted
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'defaultSaveNoteRequest': Unsatisfied dependency expressed through constructor parameter 0: Error creating bean with name 'dynamoDBTemplate': Unsatisfied dependency expressed through method 'dynamoDBTemplate' parameter 0: Error creating bean with name 'dynamoDbEnhancedClient': Unsatisfied dependency expressed through method 'dynamoDbEnhancedClient' parameter 0: Error creating bean with name 'dynamoDbClient': Unsatisfied dependency expressed through method 'dynamoDbClient' parameter 0: Error creating bean with name 'awsClientBuilderConfigurer': Instantiation of supplied bean failed
at org.springframework.beans.factory.aot.BeanInstanceSupplier.resolveArgument(BeanInstanceSupplier.java:351) ~[na:na]
at org.springframework.beans.factory.aot.BeanInstanceSupplier.resolveArguments(BeanInstanceSupplier.java:271) ~[na:na]
at org.springframework.beans.factory.aot.BeanInstanceSupplier.get(BeanInstanceSupplier.java:206) ~[na:na]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.obtainInstanceFromSupplier(AbstractAutowireCapableBeanFactory.java:1225) ~[application:6.0.4]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.obtainFromSupplier(AbstractAutowireCapableBeanFactory.java:1210) ~[application:6.0.4]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1157) ~[application:6.0.4]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:561) ~[application:6.0.4]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:521) ~[application:6.0.4]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:326) ~[application:6.0.4]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[application:6.0.4]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:324) ~[application:6.0.4]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200) ~[application:6.0.4]
at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:254) ~[application:6.0.4]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1405) ~[application:6.0.4]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1325) ~[application:6.0.4]
at org.springframework.beans.factory.aot.BeanInstanceSupplier.resolveArgument(BeanInstanceSupplier.java:334) ~[na:na]
... 36 common frames omitted
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'dynamoDBTemplate': Unsatisfied dependency expressed through method 'dynamoDBTemplate' parameter 0: Error creating bean with name 'dynamoDbEnhancedClient': Unsatisfied dependency expressed through method 'dynamoDbEnhancedClient' parameter 0: Error creating bean with name 'dynamoDbClient': Unsatisfied dependency expressed through method 'dynamoDbClient' parameter 0: Error creating bean with name 'awsClientBuilderConfigurer': Instantiation of supplied bean failed
at org.springframework.beans.factory.aot.BeanInstanceSupplier.resolveArgument(BeanInstanceSupplier.java:351) ~[na:na]
at org.springframework.beans.factory.aot.BeanInstanceSupplier.resolveArguments(BeanInstanceSupplier.java:271) ~[na:na]
at org.springframework.beans.factory.aot.BeanInstanceSupplier.get(BeanInstanceSupplier.java:206) ~[na:na]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.obtainInstanceFromSupplier(AbstractAutowireCapableBeanFactory.java:1225) ~[application:6.0.4]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.obtainFromSupplier(AbstractAutowireCapableBeanFactory.java:1210) ~[application:6.0.4]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1157) ~[application:6.0.4]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:561) ~[application:6.0.4]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:521) ~[application:6.0.4]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:326) ~[application:6.0.4]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[application:6.0.4]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:324) ~[application:6.0.4]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200) ~[application:6.0.4]
at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:254) ~[application:6.0.4]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1405) ~[application:6.0.4]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1325) ~[application:6.0.4]
at org.springframework.beans.factory.aot.BeanInstanceSupplier.resolveArgument(BeanInstanceSupplier.java:334) ~[na:na]
... 51 common frames omitted
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'dynamoDbEnhancedClient': Unsatisfied dependency expressed through method 'dynamoDbEnhancedClient' parameter 0: Error creating bean with name 'dynamoDbClient': Unsatisfied dependency expressed through method 'dynamoDbClient' parameter 0: Error creating bean with name 'awsClientBuilderConfigurer': Instantiation of supplied bean failed
at org.springframework.beans.factory.aot.BeanInstanceSupplier.resolveArgument(BeanInstanceSupplier.java:351) ~[na:na]
at org.springframework.beans.factory.aot.BeanInstanceSupplier.resolveArguments(BeanInstanceSupplier.java:271) ~[na:na]
at org.springframework.beans.factory.aot.BeanInstanceSupplier.get(BeanInstanceSupplier.java:206) ~[na:na]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.obtainInstanceFromSupplier(AbstractAutowireCapableBeanFactory.java:1225) ~[application:6.0.4]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.obtainFromSupplier(AbstractAutowireCapableBeanFactory.java:1210) ~[application:6.0.4]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1157) ~[application:6.0.4]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:561) ~[application:6.0.4]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:521) ~[application:6.0.4]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:326) ~[application:6.0.4]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[application:6.0.4]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:324) ~[application:6.0.4]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200) ~[application:6.0.4]
at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:254) ~[application:6.0.4]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1405) ~[application:6.0.4]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1325) ~[application:6.0.4]
at org.springframework.beans.factory.aot.BeanInstanceSupplier.resolveArgument(BeanInstanceSupplier.java:334) ~[na:na]
... 66 common frames omitted
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'dynamoDbClient': Unsatisfied dependency expressed through method 'dynamoDbClient' parameter 0: Error creating bean with name 'awsClientBuilderConfigurer': Instantiation of supplied bean failed
at org.springframework.beans.factory.aot.BeanInstanceSupplier.resolveArgument(BeanInstanceSupplier.java:351) ~[na:na]
at org.springframework.beans.factory.aot.BeanInstanceSupplier.resolveArguments(BeanInstanceSupplier.java:271) ~[na:na]
at org.springframework.beans.factory.aot.BeanInstanceSupplier.get(BeanInstanceSupplier.java:206) ~[na:na]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.obtainInstanceFromSupplier(AbstractAutowireCapableBeanFactory.java:1225) ~[application:6.0.4]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.obtainFromSupplier(AbstractAutowireCapableBeanFactory.java:1210) ~[application:6.0.4]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1157) ~[application:6.0.4]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:561) ~[application:6.0.4]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:521) ~[application:6.0.4]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:326) ~[application:6.0.4]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[application:6.0.4]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:324) ~[application:6.0.4]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200) ~[application:6.0.4]
at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:254) ~[application:6.0.4]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1405) ~[application:6.0.4]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1325) ~[application:6.0.4]
at org.springframework.beans.factory.aot.BeanInstanceSupplier.resolveArgument(BeanInstanceSupplier.java:334) ~[na:na]
... 81 common frames omitted
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'awsClientBuilderConfigurer': Instantiation of supplied bean failed
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.obtainInstanceFromSupplier(AbstractAutowireCapableBeanFactory.java:1236) ~[application:6.0.4]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.obtainFromSupplier(AbstractAutowireCapableBeanFactory.java:1210) ~[application:6.0.4]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1157) ~[application:6.0.4]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:561) ~[application:6.0.4]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:521) ~[application:6.0.4]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:326) ~[application:6.0.4]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[application:6.0.4]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:324) ~[application:6.0.4]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200) ~[application:6.0.4]
at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:254) ~[application:6.0.4]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1405) ~[application:6.0.4]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1325) ~[application:6.0.4]
at org.springframework.beans.factory.aot.BeanInstanceSupplier.resolveArgument(BeanInstanceSupplier.java:334) ~[na:na]
... 96 common frames omitted
Caused by: java.lang.IllegalStateException: Error when loading properties from /io/awspring/cloud/core/SpringCloudClientConfiguration.properties for resolving Spring Cloud AWS version.
at io.awspring.cloud.core.SpringCloudClientConfiguration.loadVersion(SpringCloudClientConfiguration.java:57) ~[na:na]
at io.awspring.cloud.core.SpringCloudClientConfiguration.<init>(SpringCloudClientConfiguration.java:47) ~[na:na]
at io.awspring.cloud.autoconfigure.core.AwsClientBuilderConfigurer.<init>(AwsClientBuilderConfigurer.java:47) ~[application:3.0.0-RC1]
at io.awspring.cloud.autoconfigure.core.AwsAutoConfiguration.awsClientBuilderConfigurer(AwsAutoConfiguration.java:43) ~[application:3.0.0-RC1]
at io.awspring.cloud.autoconfigure.core.AwsAutoConfiguration__BeanDefinitions.lambda$getAwsClientBuilderConfigurerInstanceSupplier$1(AwsAutoConfiguration__BeanDefinitions.java:39) ~[na:na]
at org.springframework.util.function.ThrowingBiFunction.apply(ThrowingBiFunction.java:68) ~[application:6.0.4]
at org.springframework.util.function.ThrowingBiFunction.apply(ThrowingBiFunction.java:54) ~[application:6.0.4]
at org.springframework.beans.factory.aot.BeanInstanceSupplier.lambda$get$2(BeanInstanceSupplier.java:208) ~[na:na]
at org.springframework.util.function.ThrowingSupplier.get(ThrowingSupplier.java:59) ~[application:6.0.4]
at org.springframework.util.function.ThrowingSupplier.get(ThrowingSupplier.java:47) ~[application:6.0.4]
at org.springframework.beans.factory.aot.BeanInstanceSupplier.invokeBeanSupplier(BeanInstanceSupplier.java:220) ~[na:na]
at org.springframework.beans.factory.aot.BeanInstanceSupplier.get(BeanInstanceSupplier.java:208) ~[na:na]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.obtainInstanceFromSupplier(AbstractAutowireCapableBeanFactory.java:1225) ~[application:6.0.4]
... 108 common frames omitted
Caused by: java.io.FileNotFoundException: class path resource [io/awspring/cloud/core/SpringCloudClientConfiguration.properties] cannot be opened because it does not exist
at org.springframework.core.io.ClassPathResource.getInputStream(ClassPathResource.java:211) ~[application:6.0.4]
at org.springframework.core.io.support.PropertiesLoaderUtils.fillProperties(PropertiesLoaderUtils.java:134) ~[na:na]
at org.springframework.core.io.support.PropertiesLoaderUtils.loadProperties(PropertiesLoaderUtils.java:123) ~[na:na]
at io.awspring.cloud.core.SpringCloudClientConfiguration.loadVersion(SpringCloudClientConfiguration.java:53) ~[na:na]
... 120 common frames omitted

As a solution would be to provide a resource-hint for GraalVM i.e.

{
  "resources":[{"pattern":"io/awspring/cloud/core/SpringCloudClientConfiguration.properties"}]
}
@eduanb
Copy link
Contributor

eduanb commented Feb 18, 2023

For now, this works in Spring Boot 3, with 3.0.0-RC1;

@Configuration
@ImportRuntimeHints(AwsRuntimeHints::class)
class AwsRuntimeHintsConfig

class AwsRuntimeHints : RuntimeHintsRegistrar {
    override fun registerHints(hints: RuntimeHints, classLoader: ClassLoader?) {
        hints.resources().registerPattern("io/awspring/cloud/core/SpringCloudClientConfiguration.properties")
    }
}

@maciejwalkowiak
Copy link
Contributor

Thanks @gvart and @eduanb. We are going to add official support for GraalVM native image in 3.1

@maciejwalkowiak maciejwalkowiak added the component: core Core functionality related issue label Mar 1, 2023
@maciejwalkowiak maciejwalkowiak added this to the 3.1 milestone Mar 1, 2023
@MatejNedic MatejNedic self-assigned this Apr 18, 2023
@goafabric
Copy link

goafabric commented May 13, 2023

@maciejwalkowiak
having native support would be really awesome

for s3 we also need "S3ObjectContentTypeResolver.properties"
but registering that .. will bump into the next error and the next

is there any timeline or suggestion concerning the 3.1 release ?

@goafabric : remindme

@maciejwalkowiak
Copy link
Contributor

@MatejNedic is working on native support. @MatejNedic do you have an ETA?

@MatejNedic
Copy link
Member

@maciejwalkowiak I think it will be faster if we split issue for each integration.

I have not started a work on S3 yet. Will do more work this week but can't say when it will be done.

@goafabric
Copy link

@MatejNedic thanks for your work here,
unfortunately i just don't think this will be enough for s3 support, though i am unsure if this is in scope here ?

even with native hints incorporated from your PR,
at least putobject and listBuckets will break, see below for details
I tried to figure this out on my own, with some experience concerning native images,
but this one is beyond my capabilities honestly.

In both scenarios there seems to be a problem with the endpoint resolution.
The putobject scenario can be mitigated by using "httpS" .. which will resolve correctly
but than of course break, when your s3 is not supporting https

---- cut --

putobject)
will bail out with
"Custom endpoint http://localhost:9100 was not a valid URI"
because of a check at: AwsEndpointProviderUtils.valueAsEndpointOrThrow(AwsEndpointProviderUtils.java:135)

listbuckets)
will break with

Caused by: java.lang.RuntimeException: no rules inside of tree rule matched—invalid rules (software.amazon.awssdk.services.s3.endpoints.internal.RuleEvaluator$1@592adda7)
at software.amazon.awssdk.services.s3.endpoints.internal.RuleEvaluator$1.visitTreeRule(RuleEvaluator.java:134) ~[na:na]
at software.amazon.awssdk.services.s3.endpoints.internal.RuleEvaluator$1.visitTreeRule(RuleEvaluator.java:125) ~[na:na]
at software.amazon.awssdk.services.s3.endpoints.internal.TreeRule.accept(TreeRule.java:30) ~[na:na]
at software.amazon.awssdk.services.s3.endpoints.internal.RuleEvaluator.lambda$handleRule$4(RuleEvaluator.java:125) ~[callee-service:na]

@MatejNedic
Copy link
Member

Hey @goafabric , I still have not finished S3 integration fully, tbh not sure when I will have time to fully go through it.

This happens when you are using S3Template?

All of the things that are not coming from Spring Cloud AWS, but rather from AWS Java SDK v2 should be opened to them on their GitHub.

@goafabric
Copy link

goafabric commented Aug 26, 2023

Hi @MatejNedic
thanks for your very fast reply .. it happens when you use s3Client, but from what I see s3Template mostly just delegates to s3Client, and wraps a little of the boiler plate request building (putObject -> store)

For me it's unclear if it is related to to AWS or Spring Cloud.
For the Custom Endpoint resolution, i would guess, it's the way that the Endpoint is resolved from SpringProperties and passed to the S3 Engine.
I also tried to get around this by using one of the Customizers, but to no avail.

Also from my experience, parties outside of Spring usually do not care much about GraalVM.
For Resilience4j i was able to create a simple PR, but this one her is beyond my capabilities.

So it would be nice if we find a solution .. as the bootstrap already passes .. i guess we are already near the finish line
Thx

add:
s3Template.store, gives the same error
"Custom endpoint http://localhost:9100 was not a valid URI"

@MatejNedic
Copy link
Member

MatejNedic commented Aug 27, 2023

Hey @goafabric , interesting... Could you provide a simple sample of not working S3 native, I will try to see what hints can we add in Spring Cloud AWS to resolve it.

Also, have you tried https://www.graalvm.org/latest/reference-manual/native-image/metadata/AutomaticMetadataCollection/#:~:text=GraalVM%20provides%20a%20Tracing%20Agent,on%20a%20regular%20Java%20VM. ?

The problem is if it is AWS SDK it should be fixed on their side not ours since it can cause issues with compatibility in future releases. Spring Kafka has the same issue you can check their GitHub issues and will find that they don't add hints for kafka specifics.

Edit:
I played with the sample a little bit and it worked like a charm but this was for the localstack and controller part. Will check into more details once I have more time on hand.

@goafabric
Copy link

Upload
Archiv.zip

@goafabric
Copy link

Hey @MatejNedic
thx again, i've attached an example with gradle.
With graalvm(23) installed you can just execute the native-compile command, no need for s3 beeing started.

Honestly i've spent a whole day figuring out what is going on, and vor the first time leveraging the tracing agent you mentioned.

But to now avail .. except for knowing no a lot of S3 Sourcecode :)
The problem definitely arises from the custom endpoint
=> In your example are you also using a custom endpoint with HTTP ?
And also with http only, https works.

Debugging inside S3 reveals some funky resolution of the custom endpoint, with visitor pattern, expression evaluation and a lot of classes involved.
And in the AwsEndpointProviderUtils.java:135, there is the check where it checks if the Endpoint is of Type "Endpoint" or "Str"
=> YOu have to uncomment one line in my example, noted with a comment

But the thing is, everything is mostly just pure functional programming .. there is reflection involved later one, when executing the HTTP Call, but not up to that point.

And sure you are right about future versions, but as long as 3rd party libs will not work with the reachability repository, i think this will always be a problem ..

Maybe you will see something i havent, but i have currently no more clues.
I assume the problem might not be reflection, proxy or other hints, but maybe some more general problem
like code beeing erased during graalvm compile.
I can also attach the tracing agent output .. and you propabely see what i mean
s3-metadata.zip

@maciejwalkowiak maciejwalkowiak modified the milestones: 3.1, 3.1.0 Nov 6, 2023
@maciejwalkowiak maciejwalkowiak modified the milestones: 3.1.0, 3.1 Dec 9, 2023
@MatejNedic
Copy link
Member

Hey @goafabric , Sorry for late reply are you by any chance using crt client?

@goafabric
Copy link

@MatejNedic thx 4 reaching out :)
no i am not .. at least not that i am aware of
i did however now try the latest version of localstack together with the examples you proposed earlier
and also with this combination i get the same exceptions as mentioned here

the only "workaround" is to use https instead of http .. so there seems to be some kind of funky url detection going on
that fails for native

@goafabric
Copy link

Do we have any update on the S3 Native Topic ?
I took a brief look into the crt client, but did not get very far btw

@maciejwalkowiak maciejwalkowiak removed this from the 3.1.x milestone Mar 10, 2024
@klopfdreh
Copy link
Contributor

klopfdreh commented Apr 22, 2024

Please add a file to META-INF/native-image/io.awspring.cloud.core/resource-config.json in the package that contains the properties file. (https://github.com/awspring/spring-cloud-aws/blob/main/spring-cloud-aws-core/src/main/resources/io/awspring/cloud/core/SpringCloudClientConfiguration.properties)

with the content:

{
  "resources": [
    {
      "pattern": "io/awspring/cloud/core/SpringCloudClientConfiguration.properties"
    }
  ]
}

So that we can add the following for the native-build:

native-image ... -H:ResourceConfigurationResources=META-INF/native-image/io.awspring.cloud/spring-cloud-aws/resource-config.json

See: https://www.graalvm.org/latest/reference-manual/native-image/dynamic-features/Resources/

Offtopic: S3 requires: "pattern": "io/awspring/cloud/s3/S3ObjectContentTypeResolver.properties"

With those updates I was able to use the S3PathMatchingResourcePatternResolver and access all files in a S3 bucket.

@MatejNedic
Copy link
Member

Hey @klopfdreh ,
It is already present in PR #856 . Check file
Will try to finish it finally this month have to refactor certain parts.

@klopfdreh
Copy link
Contributor

Hey @MatejNedic,

thanks a lot for the hint. Here are some related issues in

AWS SDK V2: aws/aws-sdk-java-v2#5127
AWS CRT: awslabs/aws-crt-java#780

For native image those issues appear if you use the latest version of the SDK and need also to be fixed in order to use Spring Cloud AWS with S3 TransferManager or just for download resources from S3 with S3PathMatchingResourcePatternResolver.

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
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants