简体   繁体   中英

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

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 .

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 AmazonSQSClient object. 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

尝试使用队列的 URL,而不是名称。

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

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.

在重新创建同名队列后,我也遇到了这个错误,创建一个新队列是直接的解决方案,因为我不确定新 ARN 附加需要多长时间。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM