当我将aws sdk版本从1.10.77更改为1.11.490时,出现以下异常。在我使用1.10.77之前,一切正常,现在出现以下错误。
任何建议都是有帮助的。谢谢
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk</artifactId>
<version>1.11.490</version>
<!--<version>1.10.77</version>-->
</dependency>
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>amazon-sqs-java-messaging-lib</artifactId>
<version>1.0.0</version>
</dependency>
这是我实例化sqs bean的代码
<bean id="credentialsProviderBean" class="com.amazonaws.auth.DefaultAWSCredentialsProviderChain"/>
<bean id="connectionFactoryBuilder" class="com.amazon.sqs.javamessaging.SQSConnectionFactory$Builder">
<property name="regionName" value="us-east-1"/>
<property name="numberOfMessagesToPrefetch" value="5"/>
<property name="awsCredentialsProvider" ref="credentialsProviderBean"/>
</bean>
<bean id="sqsConnectionFactory" class="com.amazon.sqs.javamessaging.SQSConnectionFactory"
factory-bean="connectionFactoryBuilder"
factory-method="build"/>
Access to the resource https://sqs.us-east-1.amazonaws.com/12234/ESMP-X-J-SHORTS-UI-SHORTS_INCOMING_SQS is denied. (Service: AmazonSQS; Status Code: 403; Error Code: AccessDenied; Request ID: 93e4c319-ddfd-5687-ae9f-97e97a5581c5)
at com.amazonaws.http.AmazonHttpClient$RequestExecutor.handleErrorResponse(AmazonHttpClient.java:1701)
at com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeOneRequest(AmazonHttpClient.java:1356)
at com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeHelper(AmazonHttpClient.java:1102)
at com.amazonaws.http.AmazonHttpClient$RequestExecutor.doExecute(AmazonHttpClient.java:759)
at com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeWithTimer(AmazonHttpClient.java:733)
at com.amazonaws.http.AmazonHttpClient$RequestExecutor.execute(AmazonHttpClient.java:715)
at com.amazonaws.http.AmazonHttpClient$RequestExecutor.access$500(AmazonHttpClient.java:675)
at com.amazonaws.http.AmazonHttpClient$RequestExecutionBuilderImpl.execute(AmazonHttpClient.java:657)
at com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:521)
at com.amazonaws.services.sqs.AmazonSQSClient.doInvoke(AmazonSQSClient.java:2215)
at com.amazonaws.services.sqs.AmazonSQSClient.invoke(AmazonSQSClient.java:2182)
at com.amazonaws.services.sqs.AmazonSQSClient.invoke(AmazonSQSClient.java:2171)
at com.amazonaws.services.sqs.AmazonSQSClient.executeReceiveMessage(AmazonSQSClient.java:1601)
at com.amazonaws.services.sqs.AmazonSQSClient.receiveMessage(AmazonSQSClient.java:1573)
at com.amazon.sqs.javamessaging.AmazonSQSMessagingClientWrapper.receiveMessage(AmazonSQSMessagingClientWrapper.java:319)
at com.amazon.sqs.javamessaging.SQSMessageConsumerPrefetch.getMessages(SQSMessageConsumerPrefetch.java:216)
at com.amazon.sqs.javamessaging.SQSMessageConsumerPrefetch.run(SQSMessageConsumerPrefetch.java:180)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
02-27-2019 09:57:44 [ConsumerPrefetchThread-1]
com.amazon.sqs.javamessaging.SQSMessageConsumerPrefetch WARN
(SQSMessageConsumerPrefetch.java:220) - Encountered exception during receive
in ConsumerPrefetch thread
javax.jms.JMSSecurityException: AmazonServiceException: receiveMessage.
RequestId: 93e4c319-ddfd-5687-ae9f-97e97a5581c5
HTTPStatusCode: 403 AmazonErrorCode: AccessDenied
at com.amazon.sqs.javamessaging.AmazonSQSMessagingClientWrapper.handleException(AmazonSQSMessagingClientWrapper.java:394)