3 Replies Latest reply on Sep 14, 2004 11:58 AM by dsengupt

    Registering as a listener to server startup


      I am trying to find a way to register my MBean class as a listener to the server notifications, specifically so that the MBean can be notified that the startup of the Jboss server is complete. I will appreciate if someone can point me in the right direction. Thanks.

        • 1. Re: Registering as a listener to server startup

          This is what i've done so far, but it gives an exception - RuntimeOperationsException: MBean jboss.system:type=Server does not implement the NotificationBroadcaster interface.
          Cause: java.lang.ClassCastException

          I'm using JBoss 3.0.4

          MBeanServer server = (MBeanServer) MBeanServerFactory.findMBeanServer(null).iterator().next();
          Set servers = server.queryNames(new ObjectName("jboss.system:type=Server"), null);
          Iterator it = servers.iterator();
          while (it.hasNext())
          ObjectName serverObjectName = (ObjectName)it.next();
          MBeanInfo info = server.getMBeanInfo(serverObjectName);

          NotificationFilterSupport filter = new NotificationFilterSupport();
          server.addNotificationListener(serverObjectName, this, filter, null);

          • 2. Re: Registering as a listener to server startup


            the emition of the notification you want was added at v3.2+, so you won't find it in any of the 3.0.x versions.

            If you considering a more generic JMX notification listener you can try out also:


            If you want you MBean to deploy last, you may also play with the DeploymentPrefixSorther defined at ./conf/jboss-service.xml


            • 3. Re: Registering as a listener to server startup

              Thanks for the information. I will check the links and see what i can extract out of them. Regards,