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

While using SQS application is failed to start #1167

Closed
sabarees19 opened this issue Jun 19, 2024 · 2 comments
Closed

While using SQS application is failed to start #1167

sabarees19 opened this issue Jun 19, 2024 · 2 comments

Comments

@sabarees19
Copy link

sabarees19 commented Jun 19, 2024

Type: Bug

Component: SQS

Describe the bug
Actually while am trying in new separate demo project it's working fine.
while am trying in main project where i used other services like s3,cognito,ses where they have used

aws.secretAccessKey=hcsahHJVGVbhwebhjbcwhjb+73478347
aws.accessKeyId=ASSJSJ67436734HJVG
aws.region=ap-south-1

<dependency>
            <groupId>software.amazon.awssdk</groupId>
            <artifactId>{service}</artifactId>
            <version>2.21.20</version>
 </dependency>

Sample

<dependency>
            <groupId>io.awspring.cloud</groupId>
            <artifactId>spring-cloud-aws-starter</artifactId>
            <version>3.1.1</version>
        </dependency>
        <dependency>
            <groupId>io.awspring.cloud</groupId>
            <artifactId>spring-cloud-aws-starter-sqs</artifactId>
            <version>3.1.1</version>
        </dependency>
        <dependency>
            <groupId>io.awspring.cloud</groupId>
            <artifactId>spring-cloud-aws-dependencies</artifactId>
            <version>3.1.1</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>

Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'listenerContainerFactory' defined in class path resource [com/demo/config/SQSConfiguration.class]: Failed to instantiate [io.awspring.cloud.sqs.config.SqsMessageListenerContainerFactory]: Factory method 'listenerContainerFactory' threw exception with message: Error creating bean with name 'sqsAsyncClient' defined in class path resource [com/demo/config/SQSConfiguration.class]: Failed to instantiate [software.amazon.awssdk.services.sqs.SqsAsyncClient]: Factory method 'sqsAsyncClient' threw exception with message: software/amazon/awssdk/utils/AttributeMap$LazyValue

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'listenerContainerFactory' defined in class path resource [com/demo/config/SQSConfiguration.class]: Failed to instantiate [io.awspring.cloud.sqs.config.SqsMessageListenerContainerFactory]: Factory method 'listenerContainerFactory' threw exception with message: Error creating bean with name 'sqsAsyncClient' defined in class path resource [com/demo/config/SQSConfiguration.class]: Failed to instantiate [software.amazon.awssdk.services.sqs.SqsAsyncClient]: Factory method 'sqsAsyncClient' threw exception with message: software/amazon/awssdk/utils/AttributeMap$LazyValue

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'listenerContainerFactory' defined in class path resource [com/demo/config/SQSConfiguration.class]: Failed to instantiate [io.awspring.cloud.sqs.config.SqsMessageListenerContainerFactory]: Factory method 'listenerContainerFactory' threw exception with message: Error creating bean with name 'sqsAsyncClient' defined in class path resource [com/demo/config/SQSConfiguration.class]: Failed to instantiate [software.amazon.awssdk.services.sqs.SqsAsyncClient]: Factory method 'sqsAsyncClient' threw exception with message: software/amazon/awssdk/utils/AttributeMap$LazyValue
at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:648) ~[spring-beans-6.1.5.jar:6.1.5]
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:485) ~[spring-beans-6.1.5.jar:6.1.5]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1335) ~[spring-beans-6.1.5.jar:6.1.5]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1165) ~[spring-beans-6.1.5.jar:6.1.5]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:562) ~[spring-beans-6.1.5.jar:6.1.5]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:522) ~[spring-beans-6.1.5.jar:6.1.5]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:326) ~[spring-beans-6.1.5.jar:6.1.5]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-6.1.5.jar:6.1.5]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:324) ~[spring-beans-6.1.5.jar:6.1.5]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200) ~[spring-beans-6.1.5.jar:6.1.5]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:975) ~[spring-beans-6.1.5.jar:6.1.5]
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:962) ~[spring-context-6.1.5.jar:6.1.5]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:624) ~[spring-context-6.1.5.jar:6.1.5]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:146) ~[spring-boot-3.2.4.jar:3.2.4]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:754) ~[spring-boot-3.2.4.jar:3.2.4]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:456) ~[spring-boot-3.2.4.jar:3.2.4]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:334) ~[spring-boot-3.2.4.jar:3.2.4]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1354) ~[spring-boot-3.2.4.jar:3.2.4]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1343) ~[spring-boot-3.2.4.jar:3.2.4]
at com.demo.VeacyApplication.main(VeacyApplication.java:14) ~[classes/:na]
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103) ~[na:na]
at java.base/java.lang.reflect.Method.invoke(Method.java:580) ~[na:na]
at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:50) ~[spring-boot-devtools-3.2.4.jar:3.2.4]
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [io.awspring.cloud.sqs.config.SqsMessageListenerContainerFactory]: Factory method 'listenerContainerFactory' threw exception with message: Error creating bean with name 'sqsAsyncClient' defined in class path resource [com/demo/config/SQSConfiguration.class]: Failed to instantiate [software.amazon.awssdk.services.sqs.SqsAsyncClient]: Factory method 'sqsAsyncClient' threw exception with message: software/amazon/awssdk/utils/AttributeMap$LazyValue
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:177) ~[spring-beans-6.1.5.jar:6.1.5]
at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:644) ~[spring-beans-6.1.5.jar:6.1.5]
... 22 common frames omitted
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqsAsyncClient' defined in class path resource [com/demo/config/SQSConfiguration.class]: Failed to instantiate [software.amazon.awssdk.services.sqs.SqsAsyncClient]: Factory method 'sqsAsyncClient' threw exception with message: software/amazon/awssdk/utils/AttributeMap$LazyValue
at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:648) ~[spring-beans-6.1.5.jar:6.1.5]
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:485) ~[spring-beans-6.1.5.jar:6.1.5]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1335) ~[spring-beans-6.1.5.jar:6.1.5]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1165) ~[spring-beans-6.1.5.jar:6.1.5]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:562) ~[spring-beans-6.1.5.jar:6.1.5]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:522) ~[spring-beans-6.1.5.jar:6.1.5]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:326) ~[spring-beans-6.1.5.jar:6.1.5]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-6.1.5.jar:6.1.5]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:324) ~[spring-beans-6.1.5.jar:6.1.5]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200) ~[spring-beans-6.1.5.jar:6.1.5]
at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.resolveBeanReference(ConfigurationClassEnhancer.java:362) ~[spring-context-6.1.5.jar:6.1.5]
at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:334) ~[spring-context-6.1.5.jar:6.1.5]
at com.demo.config.SQSConfiguration$$SpringCGLIB$$0.sqsAsyncClient() ~[classes/:na]
at com.demo.config.SQSConfiguration.listenerContainerFactory(SQSConfiguration.java:36) ~[classes/:na]
at com.demo.config.SQSConfiguration$$SpringCGLIB$$0.CGLIB$listenerContainerFactory$1() ~[classes/:na]
at com.demo.config.SQSConfiguration$$SpringCGLIB$$FastClass$$1.invoke() ~[classes/:na]
at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:258) ~[spring-core-6.1.5.jar:6.1.5]
at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:331) ~[spring-context-6.1.5.jar:6.1.5]
at com.demo.config.SQSConfiguration$$SpringCGLIB$$0.listenerContainerFactory() ~[classes/:na]
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103) ~[na:na]
at java.base/java.lang.reflect.Method.invoke(Method.java:580) ~[na:na]
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:140) ~[spring-beans-6.1.5.jar:6.1.5]
... 23 common frames omitted
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [software.amazon.awssdk.services.sqs.SqsAsyncClient]: Factory method 'sqsAsyncClient' threw exception with message: software/amazon/awssdk/utils/AttributeMap$LazyValue
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:177) ~[spring-beans-6.1.5.jar:6.1.5]
at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:644) ~[spring-beans-6.1.5.jar:6.1.5]
... 44 common frames omitted
Caused by: java.lang.NoClassDefFoundError: software/amazon/awssdk/utils/AttributeMap$LazyValue
at software.amazon.awssdk.services.sqs.DefaultSqsBaseClientBuilder.finalizeServiceConfiguration(DefaultSqsBaseClientBuilder.java:79) ~[sqs-2.21.46.jar:na]
at software.amazon.awssdk.awscore.client.builder.AwsDefaultClientBuilder.finalizeChildConfiguration(AwsDefaultClientBuilder.java:185) ~[aws-core-2.21.20.jar:na]
at software.amazon.awssdk.core.client.builder.SdkDefaultClientBuilder.asyncClientConfiguration(SdkDefaultClientBuilder.java:224) ~[sdk-core-2.21.20.jar:na]
at software.amazon.awssdk.services.sqs.DefaultSqsAsyncClientBuilder.buildClient(DefaultSqsAsyncClientBuilder.java:37) ~[sqs-2.21.46.jar:na]
at software.amazon.awssdk.services.sqs.DefaultSqsAsyncClientBuilder.buildClient(DefaultSqsAsyncClientBuilder.java:25) ~[sqs-2.21.46.jar:na]
at software.amazon.awssdk.core.client.builder.SdkDefaultClientBuilder.build(SdkDefaultClientBuilder.java:157) ~[sdk-core-2.21.20.jar:na]
at com.demo.config.SQSConfiguration.sqsAsyncClient(SQSConfiguration.java:47) ~[classes/:na]
at com.demo.config.SQSConfiguration$$SpringCGLIB$$0.CGLIB$sqsAsyncClient$2() ~[classes/:na]
at com.demo.config.SQSConfiguration$$SpringCGLIB$$FastClass$$1.invoke() ~[classes/:na]
at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:258) ~[spring-core-6.1.5.jar:6.1.5]
at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:331) ~[spring-context-6.1.5.jar:6.1.5]
at com.demo.config.SQSConfiguration$$SpringCGLIB$$0.sqsAsyncClient() ~[classes/:na]
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103) ~[na:na]
at java.base/java.lang.reflect.Method.invoke(Method.java:580) ~[na:na]
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:140) ~[spring-beans-6.1.5.jar:6.1.5]
... 45 common frames omitted
Caused by: java.lang.ClassNotFoundException: software.amazon.awssdk.utils.AttributeMap$LazyValue
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641) ~[na:na]
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188) ~[na:na]
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:526) ~[na:na]
... 60 common frames omitted

@sabarees19
Copy link
Author

I have fixed the issue it is because the other dependencies are in low versions.

@sabarees19
Copy link
Author

Fixed the issue.

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

1 participant