Related to issue #148
Spring Cloud AWS works very well for our use case, but IMO the behavior of application startup failure when failing to auto-configuring an AmazonS3 bean is a bug.
Constructing an empty Spring Boot application with Spring Cloud AWS (spring-cloud-aws-context, spring-cloud-aws-autoconfigure, and spring-cloud-aws-messaging) results in an application that fails to start up when not running on an EC2 instance.
We develop and test these applications locally, not on EC2 instances. Right now my only solution is to try to dig through the auto-configuration in spring-cloud-aws to figure out which bean to (conditionally!) turn off in the absence of an AWS environment.
To complicate matters, some of our local testing environments may require us to connect to AWS resources to validate subsystem- or system-level operation, in which case I would expect that supplying appropriate environment variables or profile settings to enable that behavior (possibly with use of @ConditionalOn*).
@glammr1 can you provide a sample error stack trace here ?
We have the same environment even for framework development, we have 3 "modes" which we use.
Local development without any dependency to AWS
Local development and calling AWS services (e.g. S3, SQS etc.)
Deployment on AWS
In general we try to make sure that you can run your applications without running on EC2, for example the region provider only tries to find the region dynamically only if you are running the application on EC2.
I would like to know where we have some gaps left here.
Perhaps solving #339 would make it clear.
I just got bit by this as well. Trying to run locally to test out CloudWatch metric publishing with 2.0.0.RC2. Still not sure how to go about configuring my project to work locally against real AWS services.
Stack trace:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.cloud.aws.context.support.io.ResourceLoaderBeanPostProcessor#0': Cannot resolve reference to bean 'amazonS3' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'amazonS3': Invocation of init method failed; nested exception is java.lang.IllegalStateException: There is no EC2 meta data available, because the application is not running in the EC2 environment. Region detection is only possible if the application is running on a EC2 instance
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:378)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:110)
at org.springframework.beans.factory.support.ConstructorResolver.resolveConstructorArguments(ConstructorResolver.java:625)
at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:153)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1276)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1133)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:543)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:503)
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:317)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:315)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:204)
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:169)
at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:694)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:532)
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:140)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:759)
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:395)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:327)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1255)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1243)
at com.panderalabs.sbat.ApplicationKt.main(Application.kt:38)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'amazonS3': Invocation of init method failed; nested exception is java.lang.IllegalStateException: There is no EC2 meta data available, because the application is not running in the EC2 environment. Region detection is only possible if the application is running on a EC2 instance
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1708)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:581)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:503)
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:317)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:315)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:367)
... 21 common frames omitted
Caused by: java.lang.IllegalStateException: There is no EC2 meta data available, because the application is not running in the EC2 environment. Region detection is only possible if the application is running on a EC2 instance
at org.springframework.util.Assert.state(Assert.java:73)
at org.springframework.cloud.aws.core.region.Ec2MetadataRegionProvider.getRegion(Ec2MetadataRegionProvider.java:39)
at org.springframework.cloud.aws.core.config.AmazonWebserviceClientFactoryBean.createInstance(AmazonWebserviceClientFactoryBean.java:92)
at org.springframework.cloud.aws.core.config.AmazonWebserviceClientFactoryBean.createInstance(AmazonWebserviceClientFactoryBean.java:44)
at org.springframework.beans.factory.config.AbstractFactoryBean.afterPropertiesSet(AbstractFactoryBean.java:141)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1767)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1704)
... 28 common frames omitted
When running locally, you need to set cloud.aws.region.static property in application.properties or application.yml file.
Read more: https://cloud.spring.io/spring-cloud-aws/spring-cloud-aws.html#_configuring_region
Is there a reason why this amazonS3 bean is always created, even if do not use anything related to S3 ?
Or can we not try to dynamically set the region if not running in EC2 ?
Hello everyone,
I am sorry that I didn’t reply any of the previous threads.
What is going on? Any problem with my Amazon EC2/S3 instance?
Regards,
Akshay Ayyanchira
Sent from Mail for Windows 10
From: Ram
Sent: 28 August 2018 07:49
To: spring-cloud/spring-cloud-aws
Cc: Akshay Ayyanchira; Manual
Subject: Re: [spring-cloud/spring-cloud-aws] Spring Boot Startup Error -Cannot resolve reference to bean amazonS3 (#272)
Is there a reason why this amazonS3 bean is always created, even if do not use anything related to S3 ?
Or can we not try to dynamically set the region if not running in EC2 ?
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.
@aemruli Sorry, we have abandoned using spring-cloud-aws for the time being as there were too many pieces that we couldn't configure to our liking or simply did not work, so I no longer have any examples.
An amazonS3 bean is always tried to be instanciated. It leads to the error above.
Even if we use other AWS products not related to S3 (kinesis, SQS)
The only workaround is to define a static region for local runs. (I have .aws metada in my user home)
I had the same issue and I was able to prevent spring cloud aws from auto configuring the region by adding this exclude on the Spring configuration.
@SpringBootApplication(exclude = ContextRegionProviderAutoConfiguration.class)
Closing this due to inactivity. Please re-open if there's more to discuss.
I encountered this issue using the library "org.springframework.cloud:spring-cloud-starter-aws-messaging". The solution was exclude auto configuration via application.yaml:
spring:
autoconfigure:
exclude:
- org.springframework.cloud.aws.autoconfigure.context.ContextInstanceDataAutoConfiguration
- org.springframework.cloud.aws.autoconfigure.context.ContextCredentialsAutoConfiguration
- org.springframework.cloud.aws.autoconfigure.context.ContextRegionProviderAutoConfiguration
- org.springframework.cloud.aws.autoconfigure.context.ContextResourceLoaderAutoConfiguration
- org.springframework.cloud.aws.autoconfigure.context.ContextStackAutoConfiguration
- org.springframework.cloud.aws.autoconfigure.mail.MailSenderAutoConfiguration
- org.springframework.cloud.aws.autoconfigure.cache.ElastiCacheAutoConfiguration
- org.springframework.cloud.aws.autoconfigure.messaging.MessagingAutoConfiguration
- org.springframework.cloud.aws.autoconfigure.jdbc.AmazonRdsDatabaseAutoConfiguration
- org.springframework.cloud.aws.autoconfigure.metrics.CloudWatchExportAutoConfiguration
I encountered this issue after adding axon framework.
For me excluding
spring.autoconfigure.exclude=org.springframework.cloud.aws.autoconfigure.context.ContextStackAutoConfiguration
in the application.properties did the trick
@aemruli Sorry, we have abandoned using spring-cloud-aws for the time being as there were too many pieces that we couldn't configure to our liking or simply did not work, so I no longer have any examples.
[ERROR] org.springframework.boot.SpringApplication - Application startup failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'amazonSNSPublisherServiceImpl': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.amazonaws.services.sns.AmazonSNSClient com.sensei.app.service.impl.AmazonSNSPublisherServiceImpl.snsClient; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'snsClient' defined in class path resource [com/sensei/app/config/AwsSnsConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.amazonaws.services.sns.AmazonSNSClient]: Factory method 'snsClient' threw exception; nested exception is java.lang.NoSuchMethodError: com.fasterxml.jackson.databind.ObjectMapper.enable([Lcom/fasterxml/jackson/core/JsonParser$Feature;)Lcom/fasterxml/jackson/databind/ObjectMapper;
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:334) ~[spring-beans-4.1.7.RELEASE.jar:4.1.7.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1210) ~[spring-beans-4.1.7.RELEASE.jar:4.1.7.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:537) ~[spring-beans-4.1.7.RELEASE.jar:4.1.7.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476) ~[spring-beans-4.1.7.RELEASE.jar:4.1.7.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:303) ~[spring-beans-4.1.7.RELEASE.jar:4.1.7.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.1.7.RELEASE.jar:4.1.7.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:299) ~[spring-beans-4.1.7.RELEASE.jar:4.1.7.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194) ~[spring-beans-4.1.7.RELEASE.jar:4.1.7.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:755) ~[spring-beans-4.1.7.RELEASE.jar:4.1.7.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:757) ~[spring-context-4.1.7.RELEASE.jar:4.1.7.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:480) ~[spring-context-4.1.7.RELEASE.jar:4.1.7.RELEASE]
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:118) ~[spring-boot-1.2.6.RELEASE.jar:1.2.6.RELEASE]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:687) ~[spring-boot-1.2.6.RELEASE.jar:1.2.6.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:321) ~[spring-boot-1.2.6.RELEASE.jar:1.2.6.RELEASE]
at org.springframework.boot.context.web.SpringBootServletInitializer.run(SpringBootServletInitializer.java:133) [spring-boot-1.2.6.RELEASE.jar:1.2.6.RELEASE]
at org.springframework.boot.context.web.SpringBootServletInitializer.createRootApplicationContext(SpringBootServletInitializer.java:124) [spring-boot-1.2.6.RELEASE.jar:1.2.6.RELEASE]
at org.springframework.boot.context.web.SpringBootServletInitializer.onStartup(SpringBootServletInitializer.java:81) [spring-boot-1.2.6.RELEASE.jar:1.2.6.RELEASE]
at org.springframework.web.SpringServletContainerInitializer.onStartup(SpringServletContainerInitializer.java:175) [spring-web-4.1.7.RELEASE.jar:4.1.7.RELEASE]
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5167) [catalina.jar:8.5.4]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:152) [catalina.jar:8.5.4]
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:724) [catalina.jar:8.5.4]
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:700) [catalina.jar:8.5.4]
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:734) [catalina.jar:8.5.4]
at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:596) [catalina.jar:8.5.4]
at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1805) [catalina.jar:8.5.4]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [na:1.8.0_191]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) [na:1.8.0_191]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [na:1.8.0_191]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [na:1.8.0_191]
at java.lang.Thread.run(Thread.java:748) [na:1.8.0_191]
Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.amazonaws.services.sns.AmazonSNSClient com.sensei.app.service.impl.AmazonSNSPublisherServiceImpl.snsClient; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'snsClient' defined in class path resource [com/sensei/app/config/AwsSnsConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.amazonaws.services.sns.AmazonSNSClient]: Factory method 'snsClient' threw exception; nested exception is java.lang.NoSuchMethodError: com.fasterxml.jackson.databind.ObjectMapper.enable([Lcom/fasterxml/jackson/core/JsonParser$Feature;)Lcom/fasterxml/jackson/databind/ObjectMapper;
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:561) ~[spring-beans-4.1.7.RELEASE.jar:4.1.7.RELEASE]
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88) ~[spring-beans-4.1.7.RELEASE.jar:4.1.7.RELEASE]
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:331) ~[spring-beans-4.1.7.RELEASE.jar:4.1.7.RELEASE]
... 29 common frames omitted
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'snsClient' defined in class path resource [com/sensei/app/config/AwsSnsConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.amazonaws.services.sns.AmazonSNSClient]: Factory method 'snsClient' threw exception; nested exception is java.lang.NoSuchMethodError: com.fasterxml.jackson.databind.ObjectMapper.enable([Lcom/fasterxml/jackson/core/JsonParser$Feature;)Lcom/fasterxml/jackson/databind/ObjectMapper;
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:599) ~[spring-beans-4.1.7.RELEASE.jar:4.1.7.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1119) ~[spring-beans-4.1.7.RELEASE.jar:4.1.7.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1014) ~[spring-beans-4.1.7.RELEASE.jar:4.1.7.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:504) ~[spring-beans-4.1.7.RELEASE.jar:4.1.7.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476) ~[spring-beans-4.1.7.RELEASE.jar:4.1.7.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:303) ~[spring-beans-4.1.7.RELEASE.jar:4.1.7.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.1.7.RELEASE.jar:4.1.7.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:299) ~[spring-beans-4.1.7.RELEASE.jar:4.1.7.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194) ~[spring-beans-4.1.7.RELEASE.jar:4.1.7.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:1120) ~[spring-beans-4.1.7.RELEASE.jar:4.1.7.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1044) ~[spring-beans-4.1.7.RELEASE.jar:4.1.7.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:942) ~[spring-beans-4.1.7.RELEASE.jar:4.1.7.RELEASE]
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:533) ~[spring-beans-4.1.7.RELEASE.jar:4.1.7.RELEASE]
... 31 common frames omitted
my code is---AwsSnsConfiguration.java
package com.sensei.app.config;
import javax.inject.Inject;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import com.amazonaws.auth.AWSCredentials;
import com.amazonaws.auth.AWSStaticCredentialsProvider;
import com.amazonaws.services.sns.AmazonSNSClient;
@Configuration
public class AwsSnsConfiguration {
@Inject
private ApplicationProperties applicationProperties;
@Bean
public AmazonSNSClient snsClient() {
String snsEndPoint = applicationProperties.getSms().getSnsEndpoint();
AWSStaticCredentialsProvider credentialsProvider = new AWSStaticCredentialsProvider(new AWSCredentials() {
@Override
public String getAWSSecretKey() {
String awsSecretKey = applicationProperties.getSms().getAwsSecretAccessKey();
return awsSecretKey;
}
@Override
public String getAWSAccessKeyId() {
String awsSecretKeyId = applicationProperties.getSms().getAwsAccessKeyId();
return awsSecretKeyId;
}
});
AmazonSNSClient snsClient = (AmazonSNSClient) AmazonSNSClient.builder()
.withCredentials(credentialsProvider)
.withRegion("us-east-1")
.build();
snsClient.setEndpoint(snsEndPoint);
return snsClient;
}
}
package com.sensei.app.service.impl;
import java.util.HashMap;
import java.util.Map;
import javax.inject.Inject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import com.amazonaws.services.sns.AmazonSNSClient;
import com.amazonaws.services.sns.model.MessageAttributeValue;
import com.amazonaws.services.sns.model.PublishRequest;
import com.amazonaws.services.sns.model.PublishResult;
import com.sensei.app.config.ApplicationProperties;
import com.sensei.app.service.AmazonSNSPublisherService;
@Service
public class AmazonSNSPublisherServiceImpl implements AmazonSNSPublisherService {
private final Logger log = LoggerFactory.getLogger(AmazonSNSPublisherServiceImpl.class);
@Inject
private ApplicationProperties applicationProperties;
@Inject
private AmazonSNSClient snsClient;
@Override
public String sendSms(String message, String phoneNumber, String smsType) {
String msgId = "";
Map<String, MessageAttributeValue> smsAttributeValues = new HashMap<String, MessageAttributeValue>();
smsAttributeValues.put("AWS.SNS.SMS.MaxPrice", new MessageAttributeValue().withStringValue("0.50") // Sets the
// max price
// to 0.50
// USD.
.withDataType("Number"));
smsAttributeValues.put("AWS.SNS.SMS.SMSType", new MessageAttributeValue().withStringValue(smsType) // Sets the
// sms type
// Transactional/Promotional.
.withDataType("String"));
try {
PublishResult result = snsClient.publish(new PublishRequest().withMessage(message)
.withMessageAttributes(smsAttributeValues).withPhoneNumber("+91" + phoneNumber));
msgId = result.toString();
log.info("msgId : " + result.toString());
} catch (Exception e) {
log.info("error message :" + e.getMessage());
return e.getMessage();
}
return "success" + "|" + msgId;
}
}
This issue should be reopened since it's not fixed.
For me excluding
spring.autoconfigure.exclude=org.springframework.cloud.aws.autoconfigure.context.ContextStackAutoConfiguration
in the application.properties did the trick
Same for me but it gives many warnings with exceptions "SdkClientException: Failed to connect to service endpoint" and doesn't let terminate the application normally.
It's good as a workaround but not as a solution.
Also @maciejwalkowiak setting cloud.aws.region.static is not good for local running. AWS SDK for Java uses default chain to load not only credentials but other properties too (including region).
Spring Boot instead just loads credentials and requires us to provide cloud.aws.region.static manually.
Also @maciejwalkowiak setting cloud.aws.region.static is not good for local running. AWS SDK for Java uses default chain to load not only credentials but other properties too (including region).
Spring Boot instead just loads credentials and requires us to provide cloud.aws.region.static manually.
I am not saying that it's a good solution. All I am saying is that this is a workaround I found when working with Spring Cloud AWS.
Most helpful comment
I encountered this issue after adding axon framework.
For me excluding
spring.autoconfigure.exclude=org.springframework.cloud.aws.autoconfigure.context.ContextStackAutoConfigurationin the application.properties did the trick