0 Replies Latest reply on Aug 2, 2017 1:54 AM by Eric Zhao

    wildfly10: ReflectionException when call the method of other service.

    Eric Zhao Newbie

      Hello,

       

      I am new to wildfly, we are trying to migrate jboss 6.1.0 to wildfly.  here we have two services, one is StartUpService in startup.sar ,Another is another service name AAdapter in alfa.sar.

       

      in StartUpService,

       

      public class StartUpService extends ServiceMBeanSupport

        implements StartUpServiceMBean

      {

      Boolean get_status() {return true}; // for example

      }

       

       

      I noticed StartUpService already started in server.log,

      2017-08-02 13:24:41,080 DEBUG [com.test.StartUpService] (MSC service thread 1-5) Creating com.test:service=StartUpService

      2017-08-02 13:24:41,080 INFO  [lifeCycleLogger] (MSC service thread 1-5) [CFMA] createService invoked for StartUpService ...

      2017-08-02 13:24:41,089 DEBUG [com.test.StartUpService] (MSC service thread 1-5) Created com.test:service=StartUpService

      2017-08-02 13:24:41,089 DEBUG [com.test.StartUpService] (MSC service thread 1-5) Starting com.test:service=StartUpService

      2017-08-02 13:24:41,262 DEBUG [com.test.StartUpService] (MSC service thread 1-5) Started com.test:service=StartUpService

       

      then in another Service AAdapter,

      private boolean getStatus()  {

         boolean started = false;

         try {

         MBeanServer server = java.lang.management.ManagementFactory.getPlatformMBeanServer();

         ObjectName name = new ObjectName("com.test:service=StartUpService");

         if(server.isRegistered(name))

         {

             String[] signature = {};

             Object[] arguments = new Object[] {};

           started = (Boolean) server.invoke(name, "get_status", arguments, signature);

         }

      } catch (Exception e) {}

       

      but I got the following error when call getStatus in AAdapter Service code:

       

      2017-08-02 13:25:21,183 ERROR [stderr] (Thread-98) javax.management.ReflectionException: No such operation: get_status

      2017-08-02 13:25:21,184 ERROR [stderr] (Thread-98)      at com.sun.jmx.mbeanserver.PerInterface.noSuchMethod(PerInterface.java:170)

      2017-08-02 13:25:21,184 ERROR [stderr] (Thread-98)      at com.sun.jmx.mbeanserver.PerInterface.invoke(PerInterface.java:112)

      2017-08-02 13:25:21,184 ERROR [stderr] (Thread-98)      at com.sun.jmx.mbeanserver.MBeanSupport.invoke(MBeanSupport.java:252)

      2017-08-02 13:25:21,184 ERROR [stderr] (Thread-98)      at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819)

      2017-08-02 13:25:21,185 ERROR [stderr] (Thread-98)      at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801)

      2017-08-02 13:25:21,185 ERROR [stderr] (Thread-98)      at org.jboss.as.jmx.PluggableMBeanServerImpl$TcclMBeanServer.invoke(PluggableMBeanServerImpl.java:1503)

      2017-08-02 13:25:21,185 ERROR [stderr] (Thread-98)      at org.jboss.as.jmx.PluggableMBeanServerImpl.invoke(PluggableMBeanServerImpl.java:724)

      2017-08-02 13:25:21,185 ERROR [stderr] (Thread-98)      at com.test.service.AlmapAdapter.getStatus(AAdapter.java:107)

      2017-08-02 13:25:21,185 ERROR [stderr] (Thread-98)      at com.test.service.AlmapAdapter.access$000(AAdapter.java:20)

      2017-08-02 13:25:21,186 ERROR [stderr] (Thread-98)      at com.test.service.AlmapAdapter$StartingPAThread.run(AlmapAdapter.java:138)

      2017-08-02 13:25:21,186 ERROR [stderr] (Thread-98) Caused by: java.lang.NoSuchMethodException: get_status()

      2017-08-02 13:25:21,186 ERROR [stderr] (Thread-98)      at com.sun.jmx.mbeanserver.PerInterface.noSuchMethod(PerInterface.java:169)

      2017-08-02 13:25:21,187 ERROR [stderr] (Thread-98)      ... 9 more

       

      Would you please help me out?

       

      Thanks in advance,

      Eric.