3 Replies Latest reply on Apr 11, 2005 9:48 AM by Scott Stark

    Accessing a MBean through a servlet...

    Erik Svensson Newbie

      Howdy all!

      I've got a mbean stuffed in an .ear that I want to access from a servlet
      using jboss 3.2.6RC1 and the servlet in the local tomcat.

      However, I can't seem to get at it. My servlet code:

      MBeanServer serv = org.jboss.mx.util.MBeanServerLocator.locateJBoss();
      ObjectName on = new ObjectName("jboss.management.local:name=naps.payment\":\"service\"=\"VendorConnectionTest");
      Object remote_res = serv.invoke(on,"doTest",new Object[0],new String[0]);

      I get a javax.management.InstanceNotFoundException which seems strange to me since I can see the mbean in the jmx console (that's where I got the name).
      So, how do I do this?

      Erik Svensson

        • 1. Re: Accessing a MBean through a servlet...
          Scott Stark Master

          That certainly does not look a valid jmx object name string. It should be:


          • 2. Re: Accessing a MBean through a servlet...
            Erik Svensson Newbie

            THnx for the prompt reply.
            I changed the name string (and renamed it to avoid possible local confusion). That, however, did not help.

            I get

            avax.management.InstanceNotFoundException: jboss.management.local:name=naps.monitor,service=VendorConnectionTest is not registered.
            at org.jboss.mx.server.registry.BasicMBeanRegistry.get(BasicMBeanRegistry.java:462)
            at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:470)
            at com.ongame.monitor.sermon.Sermon.doGet(Sermon.java:68)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:697)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)
            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
            at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)

            but I can see the mbean in the jmx console window.
            So, I'm still in the dark.

            Erik Svensson