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

9

54

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

Shabby answered 22/1, 2015 at 4:13 Comment(3)
Did you resolve this issue? I am having the same issue. The only difference is it works on my machine but it does not in ec2Discombobulate
@Discombobulate I'm facing the same issue. I was able to connect from my machine not from EC2. Any help ?Falter
You might look at this answer once: - https://mcmap.net/q/340160/-quot-queue-does-not-exist-quot-when-accessing-my-sqs-queueCassell
Q
40

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_.

Quan answered 22/1, 2015 at 8:46 Comment(1)
So I verified that the queue was still in region us-west-2 and the error was still there. When i removed @EnableSqs the error went away, however it did not connect to the queue.Shabby
M
10

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

Masque answered 22/8, 2016 at 14:48 Comment(0)
P
8

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

Patronize answered 15/4, 2016 at 2:37 Comment(1)
This was the case for me, except I was referencing the ARN instead of the URL in the QueuePolicy.Oxblood
D
3

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.

Dovetail answered 28/3, 2022 at 3:33 Comment(0)
J
2

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 ;)

Jaddan answered 20/6, 2016 at 19:24 Comment(0)
H
1

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.

Husking answered 21/8, 2020 at 20:5 Comment(1)
Worked for me. The queue was already defined and looking at the Sqs object in the debugger it was aiming at the correct region and was working in production but not in test. Deleting and recreating the lambda did the trickGlaucoma
H
1

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

Hydropic answered 18/10, 2023 at 14:33 Comment(0)
R
0

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.

Ridgepole answered 22/2, 2023 at 22:31 Comment(0)
D
0

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"
        }
    }
    
Doublepark answered 14/9, 2023 at 19:35 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.