3 Replies Latest reply on Oct 4, 2004 1:31 PM by Elias Ross

    invoke mbean problem

    kalmn cheung Newbie

      Hi All,


      I made a simple MBean, deployed it properly and could invoke the say(String greeting) method on jmx-console, but I got the exception when I invoked the say(String greeting) method with my client application.

      my MBean source code:

      package com.cxtg;
      import org.jboss.system.ServiceMBeanSupport;
      public class Hello extends ServiceMBeanSupport implements HelloMBean {
       public void say(String greeting) {

      package com.cxtg;
      import org.jboss.system.ServiceMBean;
      public interface HelloMBean extends ServiceMBean {
       public void say(String greeting);

      <mbean code="com.cxtg.Hello" name="jboss:service=Hello" interface="com.cxtg.HelloMBean"/>

      my client application source code

      import javax.management.MBeanServer;
      import javax.management.MBeanServerFactory;
      import javax.management.ObjectName;
      import com.cxtg.Hello;
      public class MainApp {
       public static void main(String[] args) {
       MBeanServer server=MBeanServerFactory.createMBeanServer();
       ObjectName name=new ObjectName("jboss:service=Hello");
       server.registerMBean(new Hello(), name);
       String[] sig={"String"};
       Object[] opArgs={new String("Hi")};
       server.invoke(name, "say", opArgs, sig);
       }catch(Exception e){

      ReflectionException: null
      Cause: java.lang.NoSuchMethodException: Unable to locate MBean operation for: say(String)
       at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:288)
       at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:546)
       at MainApp.main(MainApp.java:48)

      What goes wrong??? please help.

      Kalmn Cheung