1 Reply Latest reply on May 9, 2002 1:13 PM by Adrian Brock

    Classpath problem with testing MBeanServer.isInstanceOf

    Matt Smuts Newbie

      Hi all,
      I'm trying to use MBeanServer.isInstanceOf() and getting some class loading problems.

      Here's the setup, using JBoss-2.4.4:
      I've got FooMBean in Foo.jar, along with an interface IFoo. I've got a second MBean, BarMBean, in bar.jar.
      BarMBean extends IFoo.
      Both foo.jar and bar.jar are in lib/ext and both MBeans are started from JBoss.jcml. They start fine.

      Later on I try and do this in FooMBean:
      [pre]
      Iterator itMBeans = m_mbeanServer.queryMBeans(new ObjectName("MyDomain:*"), null).iterator();

      while(itMBeans.hasNext()){
      ObjectInstance objInst = (ObjectInstance)itMBeans.next();

      boolean bBelongs = m_mbeanServer.isInstanceOf(objInst.getObjectName(),"IFoo");

      if (bBelongs) {
      //doVariousStuff
      }
      }
      [/pre]
      One of the MBeans encountered in the iteration is BarMBean, which does implement IFoo.
      When MBeanServerImpl.isInstanceOf is called on an instance of BarMBean, it returns false, after
      internally getting a ClassNotFoundException.

      Anyone know why MBeanServerImpl isn't looking in lib/ext/foo.jar for IFoo (and more importantly,
      how I can get it to start doing so)?

      TIA,
      Matt