2 Replies Latest reply on Aug 17, 2007 7:11 AM by hendra_netm

    ListAllMessages return no messages using RMI, but no problem

    hendra_netm

      Hi guys,

      Previously, I test JBM mbean features using jmx-console from jboss.
      Using HTTP adaptor, all features work fine.

      However, when I am trying to use rmi, programmatically call listAllMessage, the returned list is empty, eventhough there are messages in the queue.

      Other JMX method can be called without problem, and give expected result.

      I have tried both JBM 1.3.0.G.A and 1.4.0.CR1, with the same result.

      Is it bug, or is there any configuration that I should set beforehand?
      Have anyone met the same problem?

      Thank you in advance.

      Best Regards,
      Hendra

        • 1. Re: ListAllMessages return no messages using RMI, but no pro
          timfox

          Can you post a failing code example?

          • 2. Re: ListAllMessages return no messages using RMI, but no pro
            hendra_netm

            Hi Tim,
            These are my code.

            However, I can't reproduce the error.
            It seems my computer was tired, and couldn't access the queue :o
            Yesterday and today, my code worked well. So I think the problem lies on my side not on JBM.

            Thank you very much for your attention.

            Best Regards,
            Hendra

             ic = new InitialContext();
             cf = (ConnectionFactory)ic.lookup("/ConnectionFactory");
             conn = cf.createConnection();
             Queue queue = (Queue)ic.lookup("/queue/A");
             Session sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
             MessageProducer prod = sess.createProducer(queue);
             Message mess = sess.createObjectMessage("Test Message");
            
             prod.send(mess);
            
             MBeanServerConnection mbeanServerConnection = (MBeanServerConnection)ic.lookup("jmx/invoker/RMIAdaptor");
             ObjectName objName = new ObjectName("jboss.messaging.destination:service=Queue,name=A");
             List list = (List)mbeanServerConnection.invoke(objName, "listAllMessages", new Object[]{}, new String[]{});
            
             for(java.util.Iterator iterator=list.iterator(); iterator.hasNext();)
             {
             Message msgInsideQueue = (Message)iterator.next();
             System.out.println("List message");
             }