Spring Cloud - SQS - 此wsdl版本不存在指定的队列

时间:2015-01-22 04:13:19

标签: spring amazon-web-services annotations amazon-sqs spring-cloud

我正试图让spring cloud与使用自动配置的消息一起工作。

我的属性文件包含:

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

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

我的配置类如下:

@EnableSqs
@ComponentScan
@EnableAutoConfiguration
public class Application {


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

我的听众课程:

@RestController 公共类OrderListener {

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

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

    }

}

然而,当我跑这个。我收到以下错误:

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

其他人遇到这个?任何帮助将不胜感激

5 个答案:

答案 0 :(得分:17)

此错误表示区域 us-west-2 上不存在指定的队列 orderQueue 。只需创建它就可以了。

顺便说一句,使用 @EnableAutoConfiguration 时,无需添加 @EnableSqs

答案 1 :(得分:4)

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

答案 2 :(得分:4)

阿兰的回答是正确的。此错误表示该区域us-west-2中不存在该队列。其中一个原因可能是AWS Java SDK使用us-east-1作为默认区域。来自AWS文档http://docs.aws.amazon.com/java-sdk/latest/developer-guide/java-dg-region-selection.html

  

如果您未在代码中指定区域,则AWS SDK for Java会将us-east-1用作默认区域。但是,AWS管理控制台使用us-west-2作为其默认值。因此,将AWS管理控制台与开发结合使用时,请务必在代码和控制台中指定相同的区域。

您可以使用setRegion()对象的setEndpoint()AmazonSQSClient方法在客户端中专门设置区域或终点。见http://docs.aws.amazon.com/AWSJavaSDK/latest/javadoc/com/amazonaws/services/sqs/AmazonSQS.html#setEndpoint-java.lang.String-

有关区域和端点的列表,请参阅http://docs.aws.amazon.com/general/latest/gr/rande.html#sqs_region

答案 3 :(得分:1)

使用命令行尝试 get-queue-url 时,我遇到了同样的问题。看看我有什么:

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

必须运行这个:

$aws configure

在提示'默认区域名称[...]:'下进入区域,而不是我的队列所属。然后错误就消失了。

仔细检查你的配置;)

答案 4 :(得分:1)

重新创建相同名称的队列后,我也遇到此错误,立即创建新队列是解决方案,因为我不确定新的ARN挂接要花多长时间。