4 Replies Latest reply on Jul 25, 2007 10:14 AM by rajiv konkimalla

    user defined mbeans - Notification Broadcaster

    rajiv konkimalla Newbie

      I am planning to use JBoss JMX Services and create a user defined mbean and make it as a notification broadcaster. I have successfully registered the mbean and can invoke its opreations fromt the Servlet. However, I am getting the following error when trying to register a listener to this mbean:



      17:59:57,250 ERROR [STDERR] javax.management.RuntimeOperationsException
      17:59:57,250 ERROR [STDERR] at org.jboss.mx.server.MBeanServerImpl.addNotifi
      cationListener(MBeanServerImpl.java:739)
      17:59:57,250 ERROR [STDERR] at com.clique.cmg.web.ComputeServlet.init(Comput
      eServlet.java:68)
      17:59:57,250 ERROR [STDERR] at org.apache.catalina.core.StandardWrapper.load
      Servlet(StandardWrapper.java:1161)
      17:59:57,250 ERROR [STDERR] at org.apache.catalina.core.StandardWrapper.allo
      cate(StandardWrapper.java:806)
      17:59:57,250 ERROR [STDERR] at org.apache.catalina.core.StandardWrapperValve
      .invoke(StandardWrapperValve.java:129)
      17:59:57,250 ERROR [STDERR] at org.apache.catalina.core.StandardContextValve
      .invoke(StandardContextValve.java:175)
      17:59:57,250 ERROR [STDERR] at org.jboss.web.tomcat.security.SecurityAssocia
      tionValve.invoke(SecurityAssociationValve.java:179)
      17:59:57,250 ERROR [STDERR] at org.jboss.web.tomcat.security.JaccContextValv
      e.invoke(JaccContextValve.java:84)
      17:59:57,250 ERROR [STDERR] at org.apache.catalina.core.StandardHostValve.in
      voke(StandardHostValve.java:128)
      17:59:57,250 ERROR [STDERR] at org.apache.catalina.valves.ErrorReportValve.i
      nvoke(ErrorReportValve.java:104)
      17:59:57,250 ERROR [STDERR] at org.jboss.web.tomcat.service.jca.CachedConnec
      tionValve.invoke(CachedConnectionValve.java:156)
      17:59:57,250 ERROR [STDERR] at org.apache.catalina.core.StandardEngineValve.
      invoke(StandardEngineValve.java:109)
      17:59:57,250 ERROR [STDERR] at org.apache.catalina.connector.CoyoteAdapter.s
      ervice(CoyoteAdapter.java:241)
      17:59:57,250 ERROR [STDERR] at org.apache.coyote.http11.Http11Processor.proc
      ess(Http11Processor.java:844)
      17:59:57,250 ERROR [STDERR] at org.apache.coyote.http11.Http11Protocol$Http1
      1ConnectionHandler.process(Http11Protocol.java:580)
      17:59:57,250 ERROR [STDERR] at org.apache.tomcat.util.net.JIoEndpoint$Worker
      .run(JIoEndpoint.java:447)
      17:59:57,250 ERROR [STDERR] at java.lang.Thread.run(Thread.java:619)
      17:59:57,250 ERROR [STDERR] Caused by: java.lang.IllegalArgumentException: The M
      Bean named exists but does not implement the NotificationBroadcaster interface.


      I have used the following code in the servlet:


      MBeanServer server = MBeanServerLocator.locate();
      ObjectName broadCaster = new ObjectName("TestJmxBean:service=Jmxcalculate");
      JmxListener listener = new JmxListener();
      server.addNotificationListener(broadCaster, listener, null, null);

      I made sure that the mbean extends JBossNotificationBroadcasterSupport but not sure why it gives the message.

      My fundamental question is can a user defined mbean emit notifications???