2 Replies Latest reply on Jan 25, 2002 2:24 PM by rsrivast

    invoke MBean method from EJB

    rsrivast

      I am trying to call a method of my custom MBean from a session EJB. I get the MBeanServer from MBeanServerFactory, then query the MBeanServer. The MBeanServer returns a set of ObjectInstance. Type casting ObjectInstance doesn't work.

      Any assistance will be greatly appreciated.

      Thanks.

        • 1. Re: invoke MBean method from EJB
          kogan

          You can call any management method from your MBean
          by calling

          MBeanServer.invoke(ObjectName name, String operationName,
          Object[] params, String[] signature)

          • 2. Re: invoke MBean method from EJB
            rsrivast

            Thanks! An alternative is to setAttribute(ObjectName, Attribute) and getAttribute(ObjectName, String[]). However, to make this approach work I had to expose the attribute name when adding the mbean. It may not work when invoking remote mbean.