【问题标题】:Spring Cloud - SQS - The specified queue does not exist for this wsdl versionSpring Cloud - SQS - 此wsdl版本的指定队列不存在
【发布时间】:2015-03-20 19:07:16
【问题描述】:

我正在尝试让 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
public class 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

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

【问题讨论】:

  • 您解决了这个问题吗?我有同样的问题。唯一的区别是它可以在我的机器上运行,但在 ec2 中却不行
  • @user123475 我面临同样的问题。我能够从我的机器而不是从 EC2 连接。有什么帮助吗?

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


【解决方案1】:

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

顺便说一句,使用_@EnableAutoConfiguration_时无需添加_@EnableSqs_

【讨论】:

  • 所以我验证了队列仍然在区域 us-west-2 并且错误仍然存​​在。当我删除 @EnableSqs 时,错误消失了,但是它没有连接到队列。
【解决方案2】:

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

【讨论】:

  • 对我来说就是这种情况,只是我引用的是 ARN 而不是 QueuePolicy 中的 URL。
【解决方案3】:

我在尝试使用命令行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】:

    阿兰的回答是正确的。此错误表明该队列在区域 us-west-2 中不存在。原因之一可能是 AWS Java 开发工具包使用 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 管理控制台与您的开发结合使用时,请务必在您的代码和控制台中指定相同的区域。

    您可以使用AmazonSQSClientobject 的setRegion()setEndpoint() 方法在客户端中专门设置区域或端点。见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

    【讨论】:

      【解决方案5】:

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

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2020-02-08
        • 2016-09-14
        • 2015-02-27
        • 1970-01-01
        • 2021-10-15
        • 1970-01-01
        • 1970-01-01
        • 2021-04-04
        相关资源
        最近更新 更多