1 Reply Latest reply on Sep 12, 2003 9:25 AM by Juha Lindfors

    Calling MBean from EJB...

    Lewis Henderson Novice

      What is the best method for calling an MBean from a Session bean both locally and remotely?

      I am assuming that the MBean has been registered in JNDI tree.

      Kind regards

      Lewis

        • 1. Re: Calling MBean from EJB...
          Juha Lindfors Master

          There's no need to bind the MBean to JNDI, only one JMX connector.

          Locally, find the MBean server reference your JBoss is running on (there's a helper class MBeanServerLocator for this) and use the MBean server interface to invoke/set/getAttribute.

          Remotely, lookup a connector (JBoss RMI Connector for instance) from the remote naming service and use the connector to invoke your MBean.

          If you want complete location transparency, you should always go through the naming lookup and invoker via connector. Notice though that at least the basic JMX connectors haven't been optimized for local calls (you will pay the serialization price even for local invocation -- sometimes acceptable for infrequently called MBeans).

          -- Juha