Return-Path: Delivered-To: apmail-geronimo-dev-archive@www.apache.org Received: (qmail 8915 invoked from network); 2 Jul 2007 23:07:37 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 2 Jul 2007 23:07:37 -0000 Received: (qmail 61360 invoked by uid 500); 2 Jul 2007 23:07:39 -0000 Delivered-To: apmail-geronimo-dev-archive@geronimo.apache.org Received: (qmail 60811 invoked by uid 500); 2 Jul 2007 23:07:38 -0000 Mailing-List: contact dev-help@geronimo.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: dev@geronimo.apache.org List-Id: Delivered-To: mailing list dev@geronimo.apache.org Received: (qmail 60799 invoked by uid 99); 2 Jul 2007 23:07:38 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 02 Jul 2007 16:07:38 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (herse.apache.org: domain of eljotpl@gmail.com designates 209.85.146.179 as permitted sender) Received: from [209.85.146.179] (HELO wa-out-1112.google.com) (209.85.146.179) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 02 Jul 2007 16:07:34 -0700 Received: by wa-out-1112.google.com with SMTP id j4so2454411wah for ; Mon, 02 Jul 2007 16:07:13 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:reply-to:sender:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition:x-google-sender-auth; b=jnDXjlRCpXimUNCszENsYJbNR34nHOEg4pkWJkRjNKrnyD51z5wez+wRohXsAlSAjK+3fiPdPA9gD5RownjsobEhRKvqBxEcrjExBJX4yIoc/Pm3T4FVVmshjEFAcp0hwsaifoUaXDnIkpaX7kuzgE4dILFltziT3qhFErnAbyc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:reply-to:sender:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition:x-google-sender-auth; b=YIB8lFRDZQY+9NEfA73DALLbquxRnJP/XOuceHKhmBoQkhcUXbbww3GRZiXuNMXTON2h7YXmyH6LomW7Kam0L2WprLyFSLpWfQ5HgsL5xjGxKpkF9OZzH3A7du3GtB1Vgad9QbZY4AwN0RuThLcv/C1PPIu7v94bIfg8FhcCmW0= Received: by 10.114.36.1 with SMTP id j1mr5602305waj.1183417633772; Mon, 02 Jul 2007 16:07:13 -0700 (PDT) Received: by 10.114.199.2 with HTTP; Mon, 2 Jul 2007 16:07:13 -0700 (PDT) Message-ID: <1b5bfeb50707021607g6907f0d5p2f23a2e919ac7418@mail.gmail.com> Date: Tue, 3 Jul 2007 01:07:13 +0200 From: "Jacek Laskowski" Reply-To: jacek@laskowski.net.pl Sender: eljotpl@gmail.com To: dev@geronimo.apache.org Subject: Remote connection with JMX Remote, MEJB and DeploymentManager MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline X-Google-Sender-Auth: 8fdd6def5717bc06 X-Virus-Checked: Checked by ClamAV on apache.org Hi, I've been experimenting with remote access to Geronimo resources. I can't understand why there are so many different ways to get the same information - JMX Remote and MEJB seem to be pretty similar and there's also DeploymentManager that lets retrieve information about resources too. Should JMX Remote be preffered over MEJB? Which one is the recommended solution to retrieve information about Geronimo resources (webapps, ejbs, appclients, etc.). Another issue I'm struggling with is to get at the information that are displayed in the Geronimo Console. In JMX Viewer, there's contextPath attribute for WebModule. Whenever a query for the attribute is issued from a JMX Remote or MEJB client the following exception is thrown: Exception in thread "main" javax.management.AttributeNotFoundException: Cannot find attribute contextPath for StandardEngine[Geronimo].StandardHost[0.0.0.0].StandardContext[/console] at org.apache.tomcat.util.modeler.ManagedBean.getGetter(ManagedBean.java:490) at org.apache.tomcat.util.modeler.BaseModelMBean.getAttribute(BaseModelMBean.java:180) The MEJB client code looks as follows: Properties props = new Properties(); props.put(InitialContext.INITIAL_CONTEXT_FACTORY, "org.apache.openejb.client.RemoteInitialContextFactory"); props.put("java.naming.provider.url", "127.0.0.1:4201"); Context initialCtx = new InitialContext(props); Object mejbObj = initialCtx.lookup("MEJBGBean/MEJB/javax.management.j2ee.Management"); ManagementHome mejbHome = (ManagementHome) mejbObj; Management mejb = mejbHome.create(); ObjectName searchpattern = new ObjectName("*:j2eeType=WebModule,*"); Set managed_object_set = (Set) mejb.queryNames(searchpattern, null); System.out.println("found " + managed_object_set.size() + " matching objects."); Iterator it = (Iterator) managed_object_set.iterator(); while (it.hasNext()) { System.out.println(it.next()); ObjectName webModule = it.next(); mejb.getAttribute(webModule, "contextPath"); } whereas the JMX Remote client is as follows: Map environment = new HashMap(); String[] credentials = new String[] { "system", "manager" }; environment.put(JMXConnector.CREDENTIALS, credentials); JMXServiceURL address = new JMXServiceURL("service:jmx:rmi:///jndi/rmi://localhost/JMXConnector"); JMXConnector jmxConnector = JMXConnectorFactory.connect(address, environment); MBeanServerConnection mbServerConn = jmxConnector.getMBeanServerConnection(); System.out.println("DefaultDomain: " + mbServerConn.getDefaultDomain()); ObjectName searchpattern = new ObjectName("*:j2eeType=WebModule,*"); Set webModules = (Set) mbServerConn.queryNames(searchpattern, null); for (ObjectName webModule : webModules) { System.out.println(webModule); System.out.println(mbServerConn.getAttribute(webModule, "contextPath")); } Why is the exception thrown? How does the console get the value of the contextPath attribute? Jacek -- Jacek Laskowski http://www.JacekLaskowski.pl