2 Replies Latest reply on Oct 6, 2006 10:11 AM by nscooper

    jmx  - invocation amethod inside a sleepycat mbean

    nscooper

      Hello All,

      I'm trying to invoke an MBean operation that's displayed in the web-console as:
      --------------------------------------------------------------------------------
      MBean Name: Domain Name: bglobal.com
      service: JEMonitor
      MBean Java Class: com.sleepycat.je.jmx.JEMonitor
      --------------------------------------------------------------------------------


      and the operation is listed as:
      --------------------------------------------------------------------------------
      void checkpoint()
      Checkpoint the environment.

      Param ParamType ParamValue ParamDescription
      force java.lang.Boolean True False If true, force a checkpoint even if there has been no activity since the last checkpoint. Returns true if a checkpoint executed.
      --------------------------------------------------------------------------------


      but I'm not having much luck with just about every possible config of source code available off the forums, etc. The code that I would really like to work (from my SAR, deployed to same server) is:
      --------------------------------------------------------------------------------
      MBeanServer server = MBeanServerLocator.locateJBoss();

      ObjectName objectName = new ObjectName("bglobal.com:name=JEMonitor");

      Object[] paramValues = new Object[] {new Boolean(true)};

      String[] methodSignature = new String[] {"java.lang.Boolean"};

      server.invoke(objectName, "checkpoint", paramValues, methodSignature);
      --------------------------------------------------------------------------------



      Please help - I've exhausted all avenues I can think of to try to understand this stuff further..... :-(

        • 1. Re: jmx  - invocation amethod inside a sleepycat mbean
          peterj

          Looku[ the server connection via JNDI. To do this, replace your first line of code with the following:

          Hashtable env = new Hashtable();
          String factory = "org.jnp.interfaces.NamingContextFactory";
          env.put(Context.INITIAL_CONTEXT_FACTORY, factory);
          String url1 = "jnp://localhost:1100";
          env.put(Context.PROVIDER_URL, url1);
          Context ctx = new InitialContext(env);
          MBeanServerConnection mconn = (MBeanServerConnection)ctx.lookup("jmx/invoker/RMIAdaptor");


          • 2. Re: jmx  - invocation amethod inside a sleepycat mbean
            nscooper

            Thanks. In fact it was my mistake, the locateJBoss() was fine, but the objectName should have referenced JEMonitor as a service, not a name.