3 Replies Latest reply on Feb 10, 2006 2:14 PM by chahua wang

    NotificationLsitener must be a MBean?

    chahua wang Newbie

      Hi Folks,


      I read this link:

      http://wiki.jboss.org/wiki/Wiki.jsp?page=ExampleMinimalNotificationListener


      Looks like the listener is a MBean and is put into sar.
      But my application is a servlet and needs to get a data from a ServiceMbean.
      For example :
      My application needs to be notified to get a new message from HelloWorldService Mbean when HelloWorldService message is changed.

      How can I solve this conflict? Thank you.

      chwang

        • 2. Re: NotificationLsitener must be a MBean?
          chahua wang Newbie

          Thank you very much!

          my servlet is in war, Jmx service is in sar.
          There is no servlet copy in sar.

          Can I just put the path and servlet class name to subsrcribe?
          or Mbean service to add lietener which includs the path and calss name?

          Thank you again

          Chwang

          • 3. Re: NotificationLsitener must be a MBean?
            chahua wang Newbie

            Thank you,
            I have figured out how to do it after reading the link again you gave me. I
            have a small question.
            javax.management.NotificationListener
            intefrce has no subscribe/unsubscribe method.

            There is ony handleNotification(Notification notification, Object handback) method.

            So I only implement handleNotification method.

            then In my code

            MyMbeanserver.addNotificationListener(objectName, myMBeanListener, null, new Integer(2));


            But I got this exception. Any idea? Thank you.

            Chwang

            java.lang.IllegalArgumentException: wrong number of arguments
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
            at java.lang.reflect.Method.invoke(Unknown Source)
            at org.jboss.jmx.connector.invoker.InvokerAdaptorService.invoke(InvokerAdaptorService.java:251)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
            at java.lang.reflect.Method.invoke(Unknown Source)
            at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141)
            at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
            at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:121)
            at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
            at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:127)
            at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
            at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:249)
            at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
            at org.jboss.invocation.jrmp.server.JRMPProxyFactory.invoke(JRMPProxyFactory.java:164)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
            at java.lang.reflect.Method.invoke(Unknown Source)
            at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141)
            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:249)
            at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
            at org.jboss.invocation.jrmp.server.JRMPInvoker$MBeanServerAction.invoke(JRMPInvoker.java:805)
            at org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:406)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
            at java.lang.reflect.Method.invoke(Unknown Source)
            at sun.rmi.server.UnicastServerRef.dispatch(Unknown Source)
            at sun.rmi.transport.Transport$1.run(Unknown Source)
            at java.security.AccessController.doPrivileged(Native Method)
            at sun.rmi.transport.Transport.serviceCall(Unknown Source)
            at sun.rmi.transport.tcp.TCPTransport.handleMessages(Unknown Source)
            at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(Unknown Source)
            at java.lang.Thread.run(Unknown Source)