1 Reply Latest reply on Jun 23, 2008 10:52 AM by Wolfgang Schneider

    How to access MBean from SessionBean

    madeinstein Newbie

      Do you know how can I call my MBean from SessionBean?

      I tried to expose my MBean via Jndi but not success so far..

      Is there a better way?


        • 1. Re: How to access MBean from SessionBean
          Wolfgang Schneider Newbie

          You can annotate your MBean implementation class with something like that:

          @Service(objectName = "my.domain:service=MyService")

          where you have to implement the local and management interfaces. Then let the container inject the reference to the MBean simply by using an EJB annotation:

          @EJB MyServiceLocal myService;
          in your session bean.

          Another approach would be to use the @Depends annotation.