awslabs / amazon-sqs-java-messaging-lib

This Amazon SQS Java Messaging Library holds the Java Message Service compatible classes, that are used for communicating with Amazon Simple Queue Service.
http://aws.amazon.com/sqs
Apache License 2.0
167 stars 146 forks source link

java.lang.NoSuchMethodError: javax.jms.MessageProducer.setDeliveryDelay #84

Open mario-iheart opened 4 years ago

mario-iheart commented 4 years ago

Hi I am using spring JMS and amazon-sqs-java-messaging-lib:1.0.8

I have a JMS template bean as final JmsTemplate jmsTemplate = new JmsTemplate(sqsConnectionFactory);

and I set the deliveryDelay as jmsTemplate.setDeliveryDelay(30000L);

The problem is that while calling the method jmsTemplate.convertAndSend

I get the below error

java.lang.NoSuchMethodError: javax.jms.MessageProducer.setDeliveryDelay(J)V at org.springframework.jms.core.JmsTemplate.doSend(JmsTemplate.java:628) at org.springframework.jms.core.JmsTemplate.doSend(JmsTemplate.java:608) at org.springframework.jms.core.JmsTemplate.lambda$send$3(JmsTemplate.java:586) at org.springframework.jms.core.JmsTemplate.execute(JmsTemplate.java:504) at org.springframework.jms.core.JmsTemplate.send(JmsTemplate.java:584) at org.springframework.jms.core.JmsTemplate.convertAndSend(JmsTemplate.java:661)

After looking at the dependency tree of my project I found that amazon-sqs-java-messaging-lib:1.0.8 uses geronimo-jms_1.1_spec in which the MessageProducer does not support setDeliveryDelay method, however I know that amazon-sqs-java-messaging-lib supports setDeliveryDelay since 1.0.6.

I got this to work by excluding geronimo-jms_1.1_spec as a transitive dependency and upgrading to geronimo-jms_2.0_spec manually in my build.gradle.

Will amazon-sqs-java-messaging-lib support geronimo-jms_2.0_spec or newer versions? Is there a recommend way of setting the deliveryDelay using the JMS template?

Thanks

gspaiva commented 4 years ago

I'm facing exactly the same problem.

rmacqueen commented 3 years ago

Same

ymywmk commented 2 years ago

Same

rickssouza commented 2 years ago

Same

ptonev commented 2 years ago

Someone to solve this?

joaorodrigues-carlsberg commented 2 years ago

this means your client is expecting JMS 2.0 and this lib only supports 1.1. Do not use setDeliveryDelay, as it is not supported.