Return-Path: Delivered-To: apmail-activemq-dev-archive@www.apache.org Received: (qmail 21164 invoked from network); 19 Jan 2011 13:34:51 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 19 Jan 2011 13:34:51 -0000 Received: (qmail 64663 invoked by uid 500); 19 Jan 2011 13:34:50 -0000 Delivered-To: apmail-activemq-dev-archive@activemq.apache.org Received: (qmail 64570 invoked by uid 500); 19 Jan 2011 13:34:49 -0000 Mailing-List: contact dev-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@activemq.apache.org Delivered-To: mailing list dev@activemq.apache.org Received: (qmail 64562 invoked by uid 99); 19 Jan 2011 13:34:48 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 19 Jan 2011 13:34:48 +0000 X-ASF-Spam-Status: No, hits=0.6 required=10.0 tests=FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,RFC_ABUSE_POST,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL,URI_HEX X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of norman.maurer@googlemail.com designates 209.85.214.171 as permitted sender) Received: from [209.85.214.171] (HELO mail-iw0-f171.google.com) (209.85.214.171) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 19 Jan 2011 13:34:43 +0000 Received: by iwn2 with SMTP id 2so936722iwn.2 for ; Wed, 19 Jan 2011 05:34:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=domainkey-signature:mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:content-type :content-transfer-encoding; bh=wgdjwNajw5YO32iwDGhZupcWZzrVHAxLx8IZUQftfdk=; b=c+DlvkhgvMwUy1wRqfCzZw2K5aocy0lM34f0747tVktrlfqUz7+ipzdM0QgccZvJwR dLf8Zskyo7j57vUedGdbyy7JL4xBo+3/x9ivxS4VKJhBhWQrvhPvOLSs/+HvtRVsN20k j0rec+sQse4tzZG6S4ftO1cnJNEN484xAXcxM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:content-type :content-transfer-encoding; b=Nyz48lRjVxb/i0W1Bu4GKjrAYdQk6h0Wy37EeyRURVw3Sl1dBOat5rvuOu4qWWaWJN XkuXFfG17xudN1+6OzQGvUR25F2d+U+rbkdTQICCtIXga6f56WksDnQaoTfchAXsfbu7 bzt6zAUPTKcBxthp+35Ds3MQAs1ARGQKjsPy4= MIME-Version: 1.0 Received: by 10.231.11.139 with SMTP id t11mr798317ibt.189.1295444063163; Wed, 19 Jan 2011 05:34:23 -0800 (PST) Sender: norman.maurer@googlemail.com Received: by 10.231.15.11 with HTTP; Wed, 19 Jan 2011 05:34:23 -0800 (PST) In-Reply-To: <1295443683935-3225364.post@n4.nabble.com> References: <1295436656888-3225127.post@n4.nabble.com> <1295438363306-3225171.post@n4.nabble.com> <1295443683935-3225364.post@n4.nabble.com> Date: Wed, 19 Jan 2011 14:34:23 +0100 X-Google-Sender-Auth: lYKd1pHZ7EsZ0-sxMah59uvtt4g Message-ID: Subject: Re: Get the number of pending messages programatically From: Norman Maurer To: dev@activemq.apache.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable I think you want to access the QueueViewMBean. See http://activemq.apache.org/jmx.html Bye, Norman 2011/1/19 oscarfh2 : > > I talked with my project manager and we are going to use the JMX approach= to > follow some standards we already have in the project. > I am able to connect, but I am having problems to call operations. > > I have this code: > > // Get MBean server connection > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0ObjectName destMgrConfigName =3D new > ObjectName(MQObjectName.DESTINATION_MANAGER_MONITOR_MBEAN_NAME); > > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0// Create operation's parameter and signat= ure arrays > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0Object opParams[] =3D {}; > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0String opSig[] =3D {}; > > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0// Invoke operation > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0ObjectName[] objectNames; > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0objectNames =3D (ObjectName[]) connection.= invoke(destMgrConfigName, > DestinationOperations.GET_DESTINATIONS, opParams, opSig); > > and get this exception in the last line: > > javax.management.InstanceNotFoundException: > com.sun.messaging.jms.server:type=3DDestinationManager,subtype=3DMonitor > =A0 =A0 =A0 =A0at > com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.getMBean(DefaultMBe= anServerInterceptor.java:1094) > =A0 =A0 =A0 =A0at > com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.getClassLoaderFor(D= efaultMBeanServerInterceptor.java:1438) > =A0 =A0 =A0 =A0at > com.sun.jmx.mbeanserver.JmxMBeanServer.getClassLoaderFor(JmxMBeanServer.j= ava:1276) > =A0 =A0 =A0 =A0at > javax.management.remote.rmi.RMIConnectionImpl$5.run(RMIConnectionImpl.jav= a:1326) > =A0 =A0 =A0 =A0at java.security.AccessController.doPrivileged(Native Meth= od) > =A0 =A0 =A0 =A0at > javax.management.remote.rmi.RMIConnectionImpl.getClassLoaderFor(RMIConnec= tionImpl.java:1323) > =A0 =A0 =A0 =A0at > javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImpl.ja= va:771) > =A0 =A0 =A0 =A0at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Met= hod) > =A0 =A0 =A0 =A0at > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java= :39) > =A0 =A0 =A0 =A0at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorI= mpl.java:25) > =A0 =A0 =A0 =A0at java.lang.reflect.Method.invoke(Method.java:597) > =A0 =A0 =A0 =A0at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerR= ef.java:305) > =A0 =A0 =A0 =A0at sun.rmi.transport.Transport$1.run(Transport.java:159) > =A0 =A0 =A0 =A0at java.security.AccessController.doPrivileged(Native Meth= od) > =A0 =A0 =A0 =A0at sun.rmi.transport.Transport.serviceCall(Transport.java:= 155) > =A0 =A0 =A0 =A0at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTr= ansport.java:535) > =A0 =A0 =A0 =A0at > sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.ja= va:790) > =A0 =A0 =A0 =A0at > sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.jav= a:649) > =A0 =A0 =A0 =A0at > java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor= .java:886) > =A0 =A0 =A0 =A0at > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.jav= a:908) > =A0 =A0 =A0 =A0at java.lang.Thread.run(Thread.java:619) > =A0 =A0 =A0 =A0at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFro= mServer(Unknown > Source) > =A0 =A0 =A0 =A0at sun.rmi.transport.StreamRemoteCall.executeCall(Unknown = Source) > =A0 =A0 =A0 =A0at sun.rmi.server.UnicastRef.invoke(Unknown Source) > =A0 =A0 =A0 =A0at com.sun.jmx.remote.internal.PRef.invoke(Unknown Source) > =A0 =A0 =A0 =A0at javax.management.remote.rmi.RMIConnectionImpl_Stub.invo= ke(Unknown > Source) > =A0 =A0 =A0 =A0at > javax.management.remote.rmi.RMIConnector$RemoteMBeanServerConnection.invo= ke(Unknown > Source) > =A0 =A0 =A0 =A0at > ActiveMQJMXConnectionTest.getMsgNumber(ActiveMQJMXConnectionTest.java:43) > =A0 =A0 =A0 =A0at ActiveMQJMXConnectionTest.main(ActiveMQJMXConnectionTes= t.java:24) > > > This makes me think it is completely wrong. > Would you know an useful link to help me? > > tks, > Oscar > -- > View this message in context: http://activemq.2283324.n4.nabble.com/Get-t= he-number-of-pending-messages-programatically-tp3225127p3225364.html > Sent from the ActiveMQ - Dev mailing list archive at Nabble.com. >