0 Replies Latest reply on Sep 11, 2006 6:28 AM by Meinert Schwartau

    Get MBean reference

    Meinert Schwartau Newbie

      Hi!

      One of my stateless session beans must call a method on a MBean.
      Is it possible to inject a reference to that MBean into my stateless session bean?

      I tried this, but it doesn't work :-(:

      public class My implements MyMBean {
       public ObjectName preRegister(MBeanServer server, ObjectName name) throws java.lang.Exception
       {
       return new ObjectName(test:service=MyMBean);
       }
      
      }
      



      @Stateless
      public class MyStatelessSessionBean implements ... {
       @Resource(mappedName="test:service=MyMBean")
       private MyMBean myMBean;
      
       ....
       public void myMethod() {
       myMBean.op();
       }
      
      }
      


      Thanks for your help
      M. Schwartau