Hi,

I am new to JMX and here is what I want to achieve.

I want to know the depth of a JMS queue which is existing on JBoss called "testQueue". 
Please note that I am able to send messages to this queue using my JMS application. 
Now, to find out this depth I want to access "QueueDepth" attribute of the "testQueue" 
MBean. Here is how my client code looks like:

==========

                        Hashtable prop = new Hashtable();
                        prop.put(Context.INITIAL_CONTEXT_FACTORY, 
"org.jboss.naming.NamingContextFactory");
                        prop.put(Context.PROVIDER_URL, "jnp://localhost:1099");
                        Context c = new InitialContext(prop);
                        RMIAdaptor a = (RMIAdaptor)c.lookup("jmx/rmi/RMIAdaptor");
                    MBeanServer mbeanServer = new RMIConnectorImpl(a);

                        ObjectName objName = new ObjectName("jboss.mq.destination" , 
"Queue" , "testQueue");
                        
                        Object depthObj = mbeanServer.getAttribute(objName, 
"MessageCounter");
                        
                        System.out.println("The depth of queue is: " + 
((Integer)depthObj).intValue());


=============

When I run it, it gives me the following error:

=======
javax.management.InstanceNotFoundException: jboss.mq.destination:Queue=testQueue is 
not registered.
        at 
org.jboss.mx.server.registry.BasicMBeanRegistry.get(BasicMBeanRegistry.java:354)
        at org.jboss.mx.server.MBeanServerImpl.getAttribute(MBeanServerImpl.java:442)

==========

Please note that I am able to view this queue using JMX console and as I have already 
mentiuoned that I am able to send messages to this queue. The JMX console shows the 
following values for this queue:

Domain  jboss.mq.destination 
service   Queue 
name     testQueue 

Any clue what am I doing wrong? Please treat this as urgent.


View the original post : 
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3847795#3847795

Reply to the post : 
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3847795


-------------------------------------------------------
This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170
Project Admins to receive an Apple iPod Mini FREE for your judgement on
who ports your project to Linux PPC the best. Sponsored by IBM. 
Deadline: Sept. 13. Go here: http://sf.net/ppc_contest.php
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to