Error: RabbitMQ and Spring - receiveMessage not found

Asked on December 20, 2014
Hi All,

I am learning Spring and RabbitMQ integration. I have craeted a receiver class, which has a method receiveMessage.

public class Receiver {

private CountDownLatch latch = new CountDownLatch(1);

public void receiveMessage(String message) {

public CountDownLatch getLatch() {
return latch;


While running application, got below error, what am I doing wrong.

 Caused by: java.lang.NoSuchMethodException: com.test.rabbitmq.MessageReceiver.receiveMessage(java.lang.String)
at java.lang.Class.getMethod( ~[na:1.7.0_45]
at org.springframework.util.MethodInvoker.prepare( ~[spring-core-4.1.3.RELEASE.jar:4.1.3.RELEASE]
at org.springframework.amqp.rabbit.listener.adapter.MessageListenerAdapter.invokeListenerMethod( ~[spring-rabbit-1.4.0.RELEASE.jar:na]

Replied on December 20, 2014
      Check  for the below line in your configuration class.

MessageListenerAdapter listenerAdapter(MessageReceiver receiver) {
return new MessageListenerAdapter(receiver, "receiveMessage");

Find the link for complete example.

Replied on December 20, 2014
Thanks for the reply.

Write Answer

©2024 | Privacy Policy | Contact Us