4 Replies Latest reply on Jan 18, 2006 6:21 PM by Scott Stark

    how to call local ejb in mbean?

    John Woo Newbie

      Hi,

      I want to have a example illustrated how to call a local EJB inside a mbean,

      can any one help?

      --
      Thanks
      John
      Toronto

        • 1. Re: how to call local ejb in mbean?
          Dimitris Andreadis Master

          This should be not different to calling an EJB remotely, just look in the local java: jndi namespace for its exposed home interface.

          • 2. Re: how to call local ejb in mbean?
            John Woo Newbie

             

            "dimitris@jboss.org" wrote:
            This should be not different to calling an EJB remotely, just look in the local java: jndi namespace for its exposed home interface.


            Not really or I don't get it.

            a local EJB can be called in a servlet, as long as the jndi-link defined correctly in web.xml and jboss-web.xml, etc,

            but for MBean, I don't know where to define the jndi for local ejb. the way to call remote ejb obviously not applied to call local ejb; the way for a servlet to call a local ejb not applied for MBean either, I think.

            • 3. Re: how to call local ejb in mbean?
              Dimitris Andreadis Master

              There is no jndi-link to declare it. Just use JNDIView through jmx-console to find where the ejb you want to access binds to (either the java: or the global namespace) and use this name when looking up the ejb,

              e.g. if I deploy docs/examples/jmx/ejb-management.jar

              i get this binding:

              +- ejb (class: org.jnp.interfaces.NamingContext)
               | +- mgmt (class: org.jnp.interfaces.NamingContext)
               | | +- MEJB (proxy: $Proxy54 implements interface javax.management.j2ee.ManagementHome,interface javax.ejb.Handle)
              


              • 4. Re: how to call local ejb in mbean?
                Scott Stark Master

                It's a jboss implementation detail that you can access a local ejb from another deployment. In general this is not possible except from a j2ee component that has declared an ejb-local-ref and bound this using an ejb-link. Such cross deployment usage requires a remote interface. If they are inside the same server the transport will be optimized away anyway.