5 Replies Latest reply on Oct 19, 2009 5:10 PM by Peter Johnson

    JNDI lookup for all the mbeans in JBoss

    Prashanth Kasulabadha Newbie

      Hi

      Is there any option in JBoss to do a JNDILookup for the MBeanServer and get all the mbeans information which could be similar to getting all the mbeans in weblogic like the below code.

      MBeanHome mbeanHome = null;
      try {
      ... // Same as earlier example

      mbeanHome =(MBeanHome)
      ctx.lookup("weblogic.management.adminhome");
      }
      catch (NamingException ne) { ... }

      Thanks in advance
      Prashanth

        • 1. Re: JNDI lookup for all the mbeans in JBoss
          Peter Johnson Master

          The JNDI name for the MBean server is "jmx/invoker/RMIAdaptor". You can cast that to MBeanServerConnection and from there get any MBean info you want.

          • 2. Re: JNDI lookup for all the mbeans in JBoss
            Prashanth Kasulabadha Newbie

            Thanks Peter

            I am not sure about this lookup, will it fetch all the mbeans.

            I also found jmx/invoker/HttpAdaptor which also gets some MBeans but I am not sure whether both fetch the same MBeans.

            It could be better if I can know the list of all the lookup strings available so that I can get maximum number of MBeans info.

            Other queries of mine are
            1. How to get the connection string from the server
            2. How to get the details of all the instances which are running in the JBoss server. (For example I have deployed three wars, a.war,b.war and c.war, I need the information of all the applications(war) like database connection string, application name, driver, connection type etc.. )

            It could be very grateful if I can get any inormation for the above queries if not the whole info.

            Thanks in advance
            Prashanth

            • 3. Re: JNDI lookup for all the mbeans in JBoss
              Peter Johnson Master

               

              I am not sure about this lookup, will it fetch all the mbeans.

              Did you even look at the javadoc for MBeanServerConnection? Like the queryMBeans() method? Perhaps looking at a JMX tutorial would help also.

              1) What kind of connection string? Database connection?
              2) JBoss AS create sevearl MBeans for each WAR deployed. You can use the MBeanServerConnection.queryMBeans() method, with a properly formatted name string, to get those MBeans.

              • 4. Re: JNDI lookup for all the mbeans in JBoss
                Prashanth Kasulabadha Newbie

                Hi Peter

                Yes Database connection for all the instances.
                Say a.war can connect to 123 machine and b.war can connect to 456 machine, I need all the war files connection string.

                Can we get them?
                Any entries in xml files needed for this. If any entries needed then it cannot be a dynamic way of fetching all the Mbeans, rather it will be only static way.

                Thanks
                Prashantgh

                • 5. Re: JNDI lookup for all the mbeans in JBoss
                  Peter Johnson Master

                  When you deploy a *-ds.xml files to define a data source connection, JBoss AS creates 4 (or 5) MBeans for the data source. I looked at all of those MBeans but could not see the connection URL in any of them. So digging through the MBeans to find that information will not work.

                  The MBeans for a web application will not tell you which data source(s) that web app is using, such information is not kept within the metadata for the application because ti could connect to any data source and there is no need to tell JBoss AS beforehand which data source it will use.

                  On the other hand, I could just be misunderstanding your question...