1 Reply Latest reply: Jul 27, 2010 9:20 AM by 791266 RSS

    How to register two MBeans onto the same domain

    843798
      Hi All,
      I wrote the following code to register to MBeans onto the domain "HelloAgent2".But,it is not working.Can i register two MBeans like this or do i need to use loggers to register the second MBean.

      MBeanServer mbs = null;
      mbs = MBeanServerFactory.createMBeanServer( "HelloAgent2" );

      SampleDynBean2 sample=new SampleDynBean2();//Dynamic MBean
      SampleDynBean3 sample2=new SampleDynBean3();//Dynamic MBean

      ObjectName sobj2=null;
      ObjectName sobj3=null;

      sobj3=new ObjectName("SamDynBean3:bean=sample");
      sobj2=new ObjectName("SamDynBean2:bean=sample");
      mbs.registerMBean(sample, sobj2);
      mbs.registerMBean(sample2,sobj3);

      Regards
      Ravi
      Mail Me:x_netala@ugs.com