2 Replies Latest reply on Oct 13, 2009 4:49 AM by Bijith Kumar

    Unable to access 'QueueNames' attribute of 'AddressControl'

    Bijith Kumar Master

      Hi,

      I am trying to read 'QueueNames' and 'Address' attributes of a Queue using the below java code. 'Address' attribute is read successfully but 'QueueNames' attribute fails with javax.management.AttributeNotFoundException: QueueNames not accessible.
      Am I missing something?

      import java.util.HashMap;
      
      import javax.management.MBeanServerConnection;
      import javax.management.MBeanServerInvocationHandler;
      import javax.management.ObjectName;
      import javax.management.remote.JMXConnector;
      import javax.management.remote.JMXConnectorFactory;
      import javax.management.remote.JMXServiceURL;
      
      import org.hornetq.core.management.AddressControl;
      import org.hornetq.core.management.ObjectNames;
      
      
      public class HornetQJmxControl
      {
       private final String JMX_URL = "service:jmx:rmi:///jndi/rmi://localhost:3000/jmxrmi";
       public static void main(String[] args) throws Exception
       {
       (new HornetQJmxControl()).start();
       }
      
       public void start() throws Exception
       {
       ObjectName on = ObjectNames.getJMSQueueObjectName("ExpiryQueue");
       JMXConnector connector = JMXConnectorFactory.connect(new JMXServiceURL(JMX_URL), new HashMap());
       MBeanServerConnection mbsc = connector.getMBeanServerConnection();
       AddressControl addrControl = (AddressControl)MBeanServerInvocationHandler.newProxyInstance(mbsc,
       on,
       AddressControl.class,
       false);
      
       System.out.println(addrControl.getAddress());
       System.out.println(addrControl.getQueueNames());
      
       }
      
      }