4 Replies Latest reply on Apr 10, 2006 3:17 PM by Will Jones

    Jboss JMX and jini lookup service

    Will Jones Newbie

      BACKGROUND:
      I have a handfull of services (MyService) that all do the same thing, but can only handle one request at a time.
      I need to have them managable through JMX.
      I need to make it easy for a client to discover an available MyService and use it.
      We currently use JBoss as our application server.

      IMPLIMENTATION:
      I have the MyServices register themselves with a jini lookup service (reggie) using jeri (Jini Extensable Remote Invocation).
      The MyServices (and their remote proxy) impliment an MBean interface (MyServiceMBean) so they can be registered with an MBean server.
      I have an MBeanService (MyServiceMonitor) register itself as a ServiceDiscoveryListener with the jini lookup service.
      When MyServiceMonitor is notified that a MyService has been registered with the jini lookup service, it gets a remote proxy object (which impliments ProxyMBean) and registers that object with the MBean server.
      So at this point, the MyService is registered with the jini lookup service and also with the MBean server. The client can find a service and use it, and the services can be managed by connecting to the JMX Agent via a HTTP connector, or whatever the Agent supports.

      PROBLEM:
      This works fine with an Agent using java's JMX reference implimentation, but now I am trying integrate with JBoss. I am trying to bring in the JMX stuff first. I built a SAR for the MyServiceMonitor, that is working great. It registers the MyService proxys when notified. I can still access the service with a client (the jini side works) but when going to the jmx-console, I can see the MyService MBeans that are registered, and when I go to manage one, I can see all the attribute names and methods, but the vales for the attributes are "javax.management.ReflectionException", and when I try to invoke a method, I get the following exception:

      09:48:58,578 ERROR [[HtmlAdaptor]] Servlet.service() for servlet HtmlAdaptor threw exception
      javax.management.ReflectionException
      at org.jboss.mx.interceptor.ReflectedDispatcher.handleInvocationExceptions(ReflectedDispatcher.java:171)
      at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:149)
      at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
      at org.jboss.mx.server.Invocation.invoke(Invocation.java:72)
      at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:245)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
      at org.jboss.jmx.adaptor.control.Server.invokeOpByName(Server.java:243)
      at org.jboss.jmx.adaptor.control.Server.invokeOp(Server.java:208)
      at org.jboss.jmx.adaptor.html.HtmlAdaptorServlet.invokeOp(HtmlAdaptorServlet.java:247)
      at org.jboss.jmx.adaptor.html.HtmlAdaptorServlet.processRequest(HtmlAdaptorServlet.java:85)
      at org.jboss.jmx.adaptor.html.HtmlAdaptorServlet.doPost(HtmlAdaptorServlet.java:67)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
      ...


      One more note, before registering the MyService proxy object with the MBean server (in the MyServiceMonitor), the proxy works properly.

      SUGGESTIONS???
      I've put alot of effort into this project, and really would like to continue on the path chosen, but I am not die-hard on it. If there is a better, easier way, I am open to suggestions. I would really appreciate if anyone has insight on why this worked in java's reference implimentation of JMX, and not JBoss's.

      This is the first time I've written anything using JMX or jini. From what I've read, jini is aging fast. Most posts or articles that I've come accross was a couple years old, not much recent stuff.

      Thanks for drudging through this with me,
      -Will

        • 1. Re: Jboss JMX and jini lookup service
          Scott Stark Master

          There is not enough detail on the exception to know why the edit failed. Full stacktrace and details on the attribute being updated are needed.

          • 2. Re: Jboss JMX and jini lookup service
            Will Jones Newbie

             

            2006-04-07 08:54:52,640 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/jmx-console].[HtmlAdaptor]] Servlet.service() for servlet HtmlAdaptor threw exception
            javax.management.ReflectionException
             at org.jboss.mx.interceptor.ReflectedDispatcher.handleInvocationExceptions(ReflectedDispatcher.java:171)
             at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:149)
             at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
             at org.jboss.mx.server.Invocation.invoke(Invocation.java:72)
             at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:245)
             at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
             at org.jboss.jmx.adaptor.control.Server.invokeOpByName(Server.java:243)
             at org.jboss.jmx.adaptor.control.Server.invokeOp(Server.java:208)
             at org.jboss.jmx.adaptor.html.HtmlAdaptorServlet.invokeOp(HtmlAdaptorServlet.java:247)
             at org.jboss.jmx.adaptor.html.HtmlAdaptorServlet.processRequest(HtmlAdaptorServlet.java:85)
             at org.jboss.jmx.adaptor.html.HtmlAdaptorServlet.doPost(HtmlAdaptorServlet.java:67)
             at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
             at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
             at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
             at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
             at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
             at java.lang.reflect.Method.invoke(Method.java:585)
             at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:243)
             at java.security.AccessController.doPrivileged(Native Method)
             at javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
             at org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:275)
             at org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:161)
             at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:245)
             at org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:50)
             at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:156)
             at java.security.AccessController.doPrivileged(Native Method)
             at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:152)
             at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:81)
             at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
             at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
             at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
             at java.lang.reflect.Method.invoke(Method.java:585)
             at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:243)
             at java.security.AccessController.doPrivileged(Native Method)
             at javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
             at org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:275)
             at org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:217)
             at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:197)
             at org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:50)
             at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:156)
             at java.security.AccessController.doPrivileged(Native Method)
             at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:152)
             at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
             at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
             at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:39)
             at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:159)
             at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:59)
             at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
             at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
             at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
             at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
             at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
             at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
             at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
             at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
             at java.lang.Thread.run(Thread.java:595)
            Caused by: java.lang.IllegalAccessException: Class org.jboss.mx.interceptor.ReflectedDispatcher can not access a member of class com.sun.jini.example.hello.Proxy with modifiers "public"
             at sun.reflect.Reflection.ensureMemberAccess(Reflection.java:65)
             at java.lang.reflect.Method.invoke(Method.java:578)
             at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141)
             ... 54 more
            


            And any of the attributes changed (String or boolean) or any of the methods invoked causes this. This particular output was when I invoked a method that on a remote jvm, sleeps for 15 seconds then returns a helloworld string

            Thank you for your interest,
            Will

            • 3. Re: Jboss JMX and jini lookup service
              Will Jones Newbie

              Is this the way I should be handeling this? I haven't seen anywhere that I should be registering remote manageable resources to a single MBeanServer. Should each manageable resource have it's own MBeanServer?

              • 4. Re: Jboss JMX and jini lookup service
                Will Jones Newbie

                Check it out:

                System.out.println("Say hello: " + gale.sayHello() );
                server.registerMBean( gale, galeName );
                server.invoke(galeName, "sayHello", null, null);
                


                produces this output:

                15:10:05,037 INFO [STDOUT] Say hello: Hello World!
                15:10:05,037 INFO [STDOUT] Exception registering GaleMBean:
                15:10:05,037 INFO [STDOUT] javax.management.ReflectionException
                15:10:05,037 INFO [STDOUT] at org.jboss.mx.interceptor.ReflectedDispatcher.handleInvocationExceptions(ReflectedDispatcher.java:171)
                15:10:05,037 INFO [STDOUT] at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:149)
                15:10:05,037 INFO [STDOUT] at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
                15:10:05,037 INFO [STDOUT] at org.jboss.mx.server.Invocation.invoke(Invocation.java:72)
                15:10:05,037 INFO [STDOUT] at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:245)
                15:10:05,053 INFO [STDOUT] at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
                15:10:05,053 INFO [STDOUT] at com.sun.jini.example.hello.GaleServiceMonitor.serviceAdded(GaleServiceMonitor.java:115)
                15:10:05,053 INFO [STDOUT] at net.jini.lookup.ServiceDiscoveryManager$LookupCacheImpl.serviceNotifyDo(ServiceDiscoveryManager.java:2130)
                15:10:05,053 INFO [STDOUT] at net.jini.lookup.ServiceDiscoveryManager$LookupCacheImpl.serviceNotifyDo(ServiceDiscoveryManager.java:2117)
                15:10:05,053 INFO [STDOUT] at net.jini.lookup.ServiceDiscoveryManager$LookupCacheImpl.addServiceNotify(ServiceDiscoveryManager.java:2077)
                15:10:05,053 INFO [STDOUT] at net.jini.lookup.ServiceDiscoveryManager$LookupCacheImpl.access$2500(ServiceDiscoveryManager.java:821)
                15:10:05,053 INFO [STDOUT] at net.jini.lookup.ServiceDiscoveryManager$LookupCacheImpl$NewOldServiceTask.run(ServiceDiscoveryManager.java:1393)
                15:10:05,053 INFO [STDOUT] at net.jini.lookup.ServiceDiscoveryManager$LookupCacheImpl$NotifyEventTask.run(ServiceDiscoveryManager.java:1132)
                15:10:05,053 INFO [STDOUT] at com.sun.jini.thread.TaskManager$TaskThread.run(TaskManager.java:331)
                15:10:05,053 INFO [STDOUT] Caused by: java.lang.IllegalAccessException: Class org.jboss.mx.interceptor.ReflectedDispatcher can not access a member of class com.sun.jini.example.hello.Proxy with modifiers "public"
                15:10:05,053 INFO [STDOUT] at sun.reflect.Reflection.ensureMemberAccess(Reflection.java:65)
                15:10:05,053 INFO [STDOUT] at java.lang.reflect.Method.invoke(Method.java:578)
                15:10:05,053 INFO [STDOUT] at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141)
                15:10:05,053 INFO [STDOUT] ... 12 more
                


                gale is a proxy object for an MBean running on another JVM.
                System.out.println("Say hello: " + gale.sayHello() );
                runs on the other JVM and then returns "Hello World!". I am at a loss to why I am getting the ReflectionException.

                Thanks for any insight, Will