polomarco
polomarco

Reputation: 545

Spring Cloud - SQS - The specified queue does not exist for this wsdl version

I am attempting to get spring cloud to work with messaging using auto configure.

My properties file contains:

cloud.aws.credentials.accessKey=xxxxxxxxxx
cloud.aws.credentials.secretKey=xxxxxxxxxx

cloud.aws.region.static=us-west-2

My Configuration class is as follows:

@EnableSqs
@ComponentScan
@EnableAutoConfiguration
public class Application {


public static void main(String[] args) throws Exception {
    SpringApplication.run(Application.class, args);
  }
}

My Listener class:

@RestController
public class OrderListener {

    @MessageMapping("orderQueue")
    public void orderListener(Order order){

        System.out.println("Order Name " + order.getName());
        System.out.println("Order Url" + order.getUrl());

    }
}

However, when I run this. I get the following error:

org.springframework.context.ApplicationContextException: Failed to start bean        'simpleMessageListenerContainer'; nested exception is     org.springframework.messaging.core.DestinationResolutionException: The specified queue does not exist for this wsdl version. (Service: AmazonSQS; Status Code: 400; Error Code: AWS.SimpleQueueService.NonExistentQueue; Request ID: cc8cb199-be88-5993-bd58-fca3c9f17110); nested exception is com.amazonaws.services.sqs.model.QueueDoesNotExistException: The specified queue does not exist for this wsdl version. (Service: AmazonSQS; Status Code: 400; Error Code: AWS.SimpleQueueService.NonExistentQueue; Request ID: cc8cb199-be88-5993-bd58-fca3c9f17110)
at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:176)
at org.springframework.context.support.DefaultLifecycleProcessor.access$200(DefaultLifecycleProcessor.java:51)
at org.springframework.context.support.DefaultLifecycleProcessor$LifecycleGroup.start(DefaultLifecycleProcessor.java:346)
at org.springframework.context.support.DefaultLifecycleProcessor.startBeans(DefaultLifecycleProcessor.java:149)
at org.springframework.context.support.DefaultLifecycleProcessor.onRefresh(DefaultLifecycleProcessor.java:112)
at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:770)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.finishRefresh(EmbeddedWebApplicationContext.java:140)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:483)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:118)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:691)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:321)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:961)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:950)
at com.releasebot.processor.Application.main(Application.java:40)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134)

Caused by: org.springframework.messaging.core.DestinationResolutionException: The specified queue does not exist for this wsdl version. (Service: AmazonSQS; Status Code: 400; Error Code: AWS.SimpleQueueService.NonExistentQueue; Request ID: cc8cb199-be88-5993-bd58-fca3c9f17110); nested exception is com.amazonaws.services.sqs.model.QueueDoesNotExistException: The specified queue does not exist for this wsdl version. (Service: AmazonSQS; Status Code: 400; Error Code: AWS.SimpleQueueService.NonExistentQueue; Request ID: cc8cb199-be88-5993-bd58-fca3c9f17110)
at org.springframework.cloud.aws.messaging.support.destination.DynamicQueueUrlDestinationResolver.resolveDestination(DynamicQueueUrlDestinationResolver.java:81)
at org.springframework.cloud.aws.messaging.support.destination.DynamicQueueUrlDestinationResolver.resolveDestination(DynamicQueueUrlDestinationResolver.java:37)
at org.springframework.messaging.core.CachingDestinationResolverProxy.resolveDestination(CachingDestinationResolverProxy.java:88)
at org.springframework.cloud.aws.messaging.listener.AbstractMessageListenerContainer.start(AbstractMessageListenerContainer.java:300)
at org.springframework.cloud.aws.messaging.listener.SimpleMessageListenerContainer.start(SimpleMessageListenerContainer.java:38)
at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:173)
... 18 common frames omitted

Anyone else run across this? Any help would be greatly appreciated

Upvotes: 54

Views: 134686

Answers (9)

BadPiggie
BadPiggie

Reputation: 6359

Update: 18 Oct 2023

My queue exists. I tried to connect via Queue URL and AWS Region is also correct. But, I still got this error. But I was using SDK v1

Migrating from AWS SDK v1 to v2 solved the issue.

V2: https://mvnrepository.com/artifact/software.amazon.awssdk/sqs

V1 (Avoid using this): https://mvnrepository.com/artifact/com.amazonaws/aws-java-sdk-sqs

Upvotes: 2

Guilherme Abacherli
Guilherme Abacherli

Reputation: 335

I got this error in command line (aws cli) while trying to change settings of my queue and some answers in this page helped me, I hope it could help others too.


  1. I was trying to execute this command:

    aws sqs get-queue-attributes \                                                   
    --queue-url https://sqs.sa-east-1.amazonaws.com/999/my-queue \
    --attribute-names VisibilityTimeout | cat
    
  2. And got the following error:

    An error occurred (AWS.SimpleQueueService.NonExistentQueue) when calling the GetQueueAttributes operation: The specified queue does not exist for this wsdl version.

  3. I checked the region my current aws cli session was in:

    aws configure get region
    
  4. And, looking in the AWS management console (web) I noticed that the region doesn't actually have the queue mentioned above.

  5. Then I moved to the correct region (which has the queue I'm working on):

    aws configure set region sa-east-1
    
  6. And then the command worked:

    aws sqs get-queue-attributes \                                                   
    --queue-url https://sqs.sa-east-1.amazonaws.com/999/my-queue \
    --attribute-names VisibilityTimeout | cat
    
  7. Response:

    {
        "Attributes": {
            "VisibilityTimeout": "30"
        }
    }
    

Upvotes: 0

sphanish123
sphanish123

Reputation: 1

If the queue name already exist and you still get this error make sure to run aws configure and set the region to us-east-1.

In my case the queue name existed but it was still throwing up that error, because the region was set to us-east-2. I am not sure why though, but seems like changing the region to us-east-1 to the default region fixed it for me.

Upvotes: 0

Make sure you are using the correct AWS Profile. This was the problem in my case. If you have multiple profiles you can get all:

cat ~/.aws/credentials

and then you can set a different profile:

export AWS_PROFILE=<profile_name>

Without specifying this, the current profile by default is default, so make sure you take that into account.

Upvotes: 3

Alain
Alain

Reputation: 971

This error means that the specified queue orderQueue does not exist on region us-west-2. Just create it and it should work.

Btw, there's no need to add _@EnableSqs_ when using _@EnableAutoConfiguration_.

Upvotes: 41

Wongchild
Wongchild

Reputation: 33

I also had this error after re-creating a queue of the same name, creating a new queue was the immediate solution, since I wasn't sure how long it would take until the new ARN would attach.

Upvotes: 1

factotum
factotum

Reputation: 980

Alain's answer is correct. This error indicates that the queue doesn't exist in the region us-west-2. One of the reasons could be that the AWS Java SDK uses us-east-1 as the default region. From AWS documentation http://docs.aws.amazon.com/java-sdk/latest/developer-guide/java-dg-region-selection.html

The AWS SDK for Java uses us-east-1 as the default region if you do not specify a region in your code. However, the AWS Management Console uses us-west-2 as its default. Therefore, when using the AWS Management Console in conjunction with your development, be sure to specify the same region in both your code and the console.

You can set the region or end point specifically in the client using setRegion() or setEndpoint() methods of AmazonSQSClientobject. See http://docs.aws.amazon.com/AWSJavaSDK/latest/javadoc/com/amazonaws/services/sqs/AmazonSQS.html#setEndpoint-java.lang.String-

For a list of region and endpoints see http://docs.aws.amazon.com/general/latest/gr/rande.html#sqs_region

Upvotes: 10

user1520978
user1520978

Reputation: 91

I've impacted the same issue while trying to get-queue-url using command line. Look what I had:

 A client error (AWS.SimpleQueueService.NonExistentQueue) occurred when calling the GetQueueUrl operation: The specified queue does not exist for this wsdl version.

Had to run this:

$aws configure

And under prompt 'Default region name[...]:' entered the region than my queue belongs to. Then the error disappeared.

So double check your configs ;)

Upvotes: 2

Selva
Selva

Reputation: 81

Try using URL of the queue, instead of the name.

Upvotes: 8

Related Questions