JMS Browser for MQ
reflex2java Mar 27, 2006 6:53 AMhey all,
I am facing some problem when I am trying to run a queue browser on JMS queues. The JMS queue is configured to MQ Queue. When I browse through the Local JMS queue (queue/A) I am able to browse. On the other hand When the queue is configured to MQ Queue, and when I browse I have the following error,
Cannot browse the Queue; - nested throwable: (java.lang.ClassCastException)
JNDI API lookup failed: org.jboss.mq.SpyJMSException: Cannot browse the Queue; - nested throwable: (java.lang.ClassCastException)
org.jboss.mq.SpyJMSException: Cannot browse the Queue; - nested throwable: (java.lang.ClassCastException)
at org.jboss.mq.SpyJMSException.getAsJMSException(SpyJMSException.java:66)
at org.jboss.mq.SpyJMSException.rethrowAsJMSException(SpyJMSException.java:51)
at org.jboss.mq.Connection.browse(Connection.java:861)
at org.jboss.mq.SpyQueueBrowser.getEnumeration(SpyQueueBrowser.java:83)
at JmsJmsWhatIsThis.main(JmsJmsWhatIsThis.java:74)
Caused by: java.lang.ClassCastException
at org.jboss.mq.security.ServerSecurityInterceptor.browse(ServerSecurityInterceptor.java:82)
at org.jboss.mq.server.TracingInterceptor.browse(TracingInterceptor.java:526)
at org.jboss.mq.server.JMSServerInvoker.browse(JMSServerInvoker.java:212)
at org.jboss.mq.il.uil2.ServerSocketManagerHandler.handleMsg(ServerSocketManagerHandler.java:97)
at org.jboss.mq.il.uil2.SocketManager$ReadTask.handleMsg(SocketManager.java:369)
at org.jboss.mq.il.uil2.msgs.BaseMsg.run(BaseMsg.java:377)
at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:748)
at java.lang.Thread.run(Thread.java:534)
the Client Code used was as follows,
//get queue connection factory QueueConnectionFactory qcf = (QueueConnectionFactory) ctx .lookup(cf); //create a connection qc = qcf.createQueueConnection(); //create a session. session = qc.createQueueSession(false, Session.AUTO_ACKNOWLEDGE); //get queue Queue q = (Queue) ctx.lookup(queueName); QueueBrowser qb = session.createBrowser(q); Enumeration list = qb.getEnumeration(); int count = 0; while(list.hasMoreElements()) { System.out.println("list = " + list.nextElement()); count++; }
Here basically I am interested to know the Queue debth usin JMS.