3 Replies Latest reply on May 17, 2007 11:44 AM by Steve Terpening

    Programatically creating XMBean Instance

    Todd Tidwell Newbie

      I've developed an XMBean that works fine when deployed through a jboss-service.xml. However, I've come to a point where I would like to deploy multiple instances of this XMBean programatically.

      In the past, with a standard MBean, you'd do something like this:

      ArrayList serverList = MBeanServerFactory.findMBeanServer(null);
      
      MBeanServer server = (MBeanServer) serverList.get(0);
      
      ObjectName on=new ObjectName("my.domain:service=Test");
      
      ObjectInstance mbean = server.createMBean(MyMBean.class.getName(), on);
      


      Sadly, with an XMBean the following Exception is thrown:

      javax.management.NotCompliantMBeanException: Class does not expose a management interface: java.lang.Object
      


      Obviously this is because I haven't tied it to the XML descriptor. Is there a way to programatically do this?