2 Replies Latest reply on Sep 17, 2001 7:23 AM by Juha Lindfors

    MBean usage

    Simon Webb Newbie

      Hi,

      I need a bean which provides a service to other beans inside JBoss, the bean holds some state and answers queries from other beans in the container asking for an item of information conatained within the state of the service bean. At the moment I have this implemented as a stateful session bean, but am aware that this is almost definitely not the correct way to implement what I need to do.

      It seems to me that I need to make this service available as an 'MBean', but am not sure. Could anyone please advise me on whether or not this seems the right way to go, and/or tell me how I would go about finding out how to write an MBean,

      Thanks,

      Pib.

        • 1. Re: MBean usage
          Simon Webb Newbie

          Hi,

          OK, I decided to test out using an MBean, I can get it to deploy and run fine under JBoss, but it doesnt seem to get bound into Jndi, so I can't access it from within my beans, but I am certain that its there and running, the log looks fine and I can see it on port 8082, any ideas?

          Thanks,

          Pib.

          • 2. Re: MBean usage
            Juha Lindfors Master

            MBeans are not automatically bound to JNDI. You can use the MBeanServerFactory class to find the reference to the MBeanServer and then use its methods to manipulate the MBean.

            Notice however that this is not very portable, as it relies on the fact that the MBean and the EJB can be found from within the same JVM.