Announcement Announcement Module
No announcement yet.
Issue with MessageListenerAdapter class Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Issue with MessageListenerAdapter class

    I have configured applicationContext.xml and corresponding beans like this:

    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="" xmlns:xsi=""

    <!-- Where to listen -->
    <bean id="testConnectionFactory" class="com.tibco.tibjms.TibjmsXAQueueConnectionFac tory" lazy-init="false">

    <!-- The name of the queue -->
    <bean id="testMessageQueue" class="com.tibco.tibjms.TibjmsQueue" lazy-init="false">
    <constructor-arg value="SERVICES.SPRING_TEST" />

    <!-- The container default has transaction capability -->
    <bean id="testListenerContainer" class="org.springframework.jms.listener.DefaultMes sageListenerContainer" lazy-init="false">
    <property name="connectionFactory" ref="testConnectionFactory"/>
    <property name="destination" ref="testMessageQueue"/>
    <property name="messageListener" ref="testListener"/>
    <property name="concurrentConsumers" value="3"/>

    <!-- The listenerAdapter forwards to our POJO to insert the event -->
    <bean id="testListener" class="org.springframework.jms.listener.adapter.Me ssageListenerAdapter" lazy-init="false">
    <bean class=" t"/>
    <property name="defaultListenerMethod" value="receive"/>
    <property name="messageConverter">


    And my MDP is like this ...

    public class DefaultTextMessageDelegateTest {

    public DefaultTextMessageDelegateTest() throws Exception {

    System.out.println(" ==== TEST ====");


    public String receive(TextMessage message) {

    try {

    String messageStr = message.getText();

    System.out.println("Message coming is =======\n\n: " + messageStr);

    Queue queue = (Queue) message.getJMSReplyTo();

    Enumeration names = message.getPropertyNames();

    while (names.hasMoreElements()) {
    String name = (String) names.nextElement();
    String value = message.getStringProperty(name);

    System.out.println("Name: " + name + " Value: " + value);

    if (queue == null) {
    System.out.println("Queue is null");
    } else {
    System.out.println("Queue Name is: " + queue.getQueueName());

    return "It is working good";

    } catch (Exception e) {



    return "An error occured";


    The issue is that I am not getting any TextMessage back on the queue that is specified as JMSReplyTo in the original message. Everything else is working fine. I am seeing all the debug messages and the original TextMessage in the weblogic console.

    I am using weblogic 8.1 service pack 4 and JAVA 1.4.2 and TIBCO JMS.

    Your help is greatly appreciated.

    Thanks in advance.

  • #2
    Can one of you please take a look into this one? Thank you very much.


    • #3
      First of all when posting code please use the [ code][/code ] tags the make your post reable.

      I suggest you crank up the loglevel to debug and see what is happing.


      • #4
        The reason I am expecting a TextMessage on another queue that is specified in "JMSReplyTo" is because the spring/JMS specification says that any non-null value is converted to a TextMessage and sent to the destination defined in the JMS Reply-To property of the original message. Please take a look into this one.


        • #5
          As I stated before crank up the loglevel to debug and see what is happening! Also instead of using 3 concurrent consumers start with 1 (we had some issues with multiple consumers).


          • #6
            Thanks for the prompt reply. I see the following error in the logs:

            [2007-09-05 15:02:08,161] [WARN] [org.springframework.jms.listener.DefaultMessageListenerContainer] [Execution of JMS message listener failed]
   No MessageConverter specified - cannot handle message [RAJA ... it is working good]
            	at org.springframework.jms.listener.adapter.MessageListenerAdapter.buildMessage(
            	at org.springframework.jms.listener.adapter.MessageListenerAdapter.handleResult(
            	at org.springframework.jms.listener.adapter.MessageListenerAdapter.onMessage(
            	at org.springframework.jms.listener.AbstractMessageListenerContainer.doInvokeListener(
            	at org.springframework.jms.listener.AbstractMessageListenerContainer.invokeListener(
            	at org.springframework.jms.listener.AbstractMessageListenerContainer.doExecuteListener(
            	at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.doReceiveAndExecute(
            	at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(
            	at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(
            	at org.springframework.jms.listener.DefaultMessageListenerContainer$


            • #7
              If you check the source code you will see that it fails to locate a MessageConverter. For some reason you found it necessary in your configuration to set the MessageConverter to null. Which quite effectivly disables returning any responses.

              <bean id="testListener" class="org.springframework.jms.listener.adapter.MessageListenerAdapter">
              		<bean class=""/>
              	<property name="defaultListenerMethod" value="receive"/>
              	<property name="messageConverter">
              Remove the marked lines and it should work.


              • #8
                I created new message converter and everything seems to be working fine. Thanks a lot for all your help.


                • #9
                  You don't need a MessageConverter just remove the lines and the default message converter will do it's job. It is the SimpleMessageConverter.


                  • #10
                    Yes, that is also working. Thanks.


                    • #11
                      Originally posted by Marten Deinum View Post
                      You don't need a MessageConverter just remove the lines and the default message converter will do it's job.
                      My understanding from the spring documentation is that you should set the message converter to null if you want to receive the TextMessage object.

                      public interface ResponsiveTextMessageDelegate {
                      // notice the return type...
                      String receive(TextMessage message);

                      The above example is from the doucmentation and returns a String. However with no converter specified the response fails. (You do receive a TextMessage)

                      Is the documentation wrong?