java.lang.NoSuchMethodError: javax.jms.MessageProducer.setDeliveryDelay
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
I'm facing exactly the same problem.
Same
Same
Same
Someone to solve this?
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.