9 Replies Latest reply on Nov 6, 2006 11:11 AM by editha

    jmx-console

    editha


      In the documentation it says that the jmx-console provides a listing of all MBeans registered with the MBeanServer.

      but when I try:

      myrmiadaptor.invoke(new javax.management.ObjectName("JMImplementation:service=LoaderRepository","getLoaders",new Object[]{},newString[]{});

      I get a InstanceNotFoundException:JMImpementation:service=LoaderRepsoitory is not registered

      although it is listed in jmx-console.

      Why is that?

        • 1. Re: jmx-console
          peterj

          When I want to look up an mbean, I usually go through JNDI as follows:

          Context ctx = new InitialContext(...);
          MBeanServerConnection mconn = (MBeanServerConnection)ctx.lookup("jmx/invoker/RMIAdaptor");
          String mbean = "JMImplementation:service=LoaderRepository";
          Object result = mconn.invoke(new ObjectName(mbean), "getLoaders", new Object[]{} ,newString[]{});



          • 2. Re: jmx-console
            editha

            Thank you for your answer!

            I tried to do it your way but it still isn't working. I still get the MBeanException caused by the InstanceNotFoundException..

            • 3. Re: jmx-console
              peterj

              I went to the jmx-console and noticed that the name you should be looking up is:

              String mbean = "JMImplementation:name=Default,service=LoaderRepository";

              • 4. Re: jmx-console
                editha


                Thank you very much!
                I was indeed looking at the wring name.

                • 5. Re: jmx-console
                  editha

                  Now I'm facing another problem:

                  Invoking some methods of the LoaderRepository mbean works, and invoking other methods doesn't work:

                  e.g.
                  mconn.invoke(new ObjectName(mbean), "getUrls", new Object[]{} ,newString[]{});

                  works, whereas

                  mconn.invoke(new ObjectName(mbean), "getLoaders", new Object[]{} ,newString[]{});

                  throws a ReflectionException caused by an IllegalArgumentException: Unable to find operation getLoaders() in AbstractMBeanInvoker.

                  The method getLoaders() doesn't take any arguments, so I do not know why this exception is thrown. Any ideas?

                  • 6. Re: jmx-console
                    peterj

                    There is no "getLoaders" method, nor is there a "Loaders" property. I do see a getPackageClassLoaders method.

                    • 7. Re: jmx-console
                      editha


                      Thank you for your quick answer. Where do you see that? I was looking at the jboss LoaderRepository class...

                      • 8. Re: jmx-console
                        peterj

                        I ran the jmx-console and looked at the available properties and operations.

                        • 9. Re: jmx-console
                          editha

                          Ah, now I saw it too. thanks again!

                          I thought since since it is an instance of UnifiedLoaderRepository3, I thought it was inheriting the methods of the LoaderRepository class, but it seems I was wrong..