2 Replies Latest reply on Jun 10, 2008 7:34 AM by schmiegelow

    MBean operation works only after invoking operation from jmx

    gtjonesy

      Hi,

      Using 4.2.2

      I am having what looks like a strange problem but hopping that is something simple. I have look in many different places to find an answer but I am not sure if I am looking for the right thing.

      I have an MBean that was created using this approach

      @Service (objectName="platform:service=foo")
      @Management (foo.class)


      That stores some information that is updated periodically.

      I have a class in a struts2 action that does this to access the data
      MBeanServer server = org.jboss.mx.util.MBeanServerLocator.locateJBoss();
       ObjectName name = new ObjectName("platform:service=foo");
      
      return (Collection) server.invoke(name, "fooMethod", null, null);


      The problem that I have is that this code does not work. I get this error:
      Caused by: java.lang.NullPointerException
       at org.jboss.ejb3.service.ServiceMBeanDelegate.getOperation(ServiceMBeanDelegate.java:380)
       at org.jboss.ejb3.service.ServiceMBeanDelegate.invoke(ServiceMBeanDelegate.java:214)
       ... 151 more

      But if I invoke the operation from jmx-console the method works like it should.

      Any help on what I am missing would be greatly appreciated.

      Thanks in advanced,
      Greg